# Data Archival APIs

**URL:** <https://techcommunity.softwareag.com/t/data-archival-apis/203286>\
**Category:** Forum\
**Tags:** Adabas-Natural, Adabas, Adabas-Add-on-Products, Adabas-Distributed-Data\
**Created:** [March 26, 2019, 4:42pm UTC](https://techcommunity.softwareag.com/t/data-archival-apis/203286 "2019-03-26T16:42:19Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [March 26, 2019, 4:42pm UTC](https://techcommunity.softwareag.com/t/data-archival-apis/203286/1 "2019-03-26T16:42:19Z")

</div>

I was looking at the API functionality in the Data Archive for ADABAS product in order to make it easier to report on how many records were “archived” in a given month. Currently, I go to the console under System Management Hub and to Data Archiving for Adabas 1.8.1-\>Services by (group:computer:daemon)-\>DEFAULT:CH40:DAEMON-\>Completed Activities, and then highlight each screen, copy, and paste into Excel. Usually in a month I have quite a number of screens now to copy, and sometimes when I paste into Excel it doesn’t quite paste it the way it should, so that’s a pain.

In the APIs, there appears to be a couple of functions that seemed promising: ACTIVITY-LIST and ACTIVITY-INFO. The latter gives me the information I want, but it requires knowing the Activity-ID first. From APICMD in SYSADR library:

## ADR ACTIVITY INFORMATION

## Activity-ID: 1903260700000000

Group: DEFAULT  
Plan: Sales\_Reporting  
Action: ARCHIVE\_SP\_RECAST\_CHARGE\_SUBLINE

Type: ARCHIVE  
Start Date: 20190326  
Start Time: 070101  
End Date: 20190326  
End Time: 070140

Overall Status: 0x82  
Overall RSP: 0  
Overall SUB: 0x00000000  
Overall Count: 1202

Extractor Status: 0x82  
Extractor Computer: CH40  
Extractor RSP: 0

Extractor SUB: 0x00000000  
Source Files:

Accumulator Status: 0x82  
Accumulator Computer: CH40  
Accumulator RSP: 0  
Accumulator SUB: 0x00000000  
Target Files:

Vault: VAL1  
Vault Path:  
/opt/softwareag/testvault

That would be ok if I could use the former to get the list of Activity-IDs that completed within the last month (which shouldn’t be too hard since I know the Activity-IDs are in a range with the format of YYMMDDHHIISSSSSS (e.g., 1903260700000000 ran on 2019-03-26 at 07:00:00.0000). However, ACTIVITY-LIST appears to show only currently active IDs.

Is there a way to get these APIs to give me the info I get from SMH? The only idea I have is to send what I expect to find for Activity-IDs based on how I set up the schedule, but I’d have to modify this program each time I alter the schedule or define a new action and would miss any non-scheduled activities.

Thanks in advance!

-Brian

---

<div class="post-metadata">

**Author:** ![Rob\_Jerome1](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@Rob\_Jerome1](https://techcommunity.softwareag.com/u/Rob_Jerome1)\
**Post date:** [April 4, 2019, 3:02pm UTC](https://techcommunity.softwareag.com/t/data-archival-apis/203286/2 "2019-04-04T15:02:08Z")

</div>

Hi Brian,

The Natural API does not currently have an option to retrieve the list of ‘Completed Activities’ but we can provide an update with this functionality.

We can modify the ACTIVITY-LIST function to support two optional parameters for ‘from date’ and ‘to date’. If one or both parameters are specified, instead of returning the ‘Current Activities’ the function will return the ‘Completed Activities’ before/after/between the specified dates. This will give you the list of activities to feed into the ACTIVITY-INFO function in order to get the archive details.

Let me know if this would meet your requirements.

Best Regards,

Rob.

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [April 4, 2019, 3:24pm UTC](https://techcommunity.softwareag.com/t/data-archival-apis/203286/3 "2019-04-04T15:24:24Z")

</div>

Hi Rob,

That sounds like it would be perfect. That way I can know all the Activity-IDs in that date range regardless of whether I ran any of them ad-hoc or if I defined and scheduled new activities without needing to maintain the code. Right now, I can “guess” the Activity-IDs for my currently scheduled archivals and code to that, but I would miss any ad-hoc runs and would need to change the code if I add new ones or change the schedule.

Should I put this enhancement idea into Brainstorm?

Thanks,

Brian

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [April 4, 2019, 3:46pm UTC](https://techcommunity.softwareag.com/t/data-archival-apis/203286/4 "2019-04-04T15:46:25Z")

</div>

I’ll assume the answer to the question is yes, so I went ahead and created feature request 06916 for this.

Thanks for your proposal, Rob!

---

<div class="post-metadata">

**Author:** ![Rob\_Jerome1](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@Rob\_Jerome1](https://techcommunity.softwareag.com/u/Rob_Jerome1)\
**Post date:** [April 4, 2019, 5:21pm UTC](https://techcommunity.softwareag.com/t/data-archival-apis/203286/5 "2019-04-04T17:21:21Z")

</div>

Hi Brian,

To progress, please could you open a Support Incident for Data Archiving for Adabas and quote the Brainstorm feature.

Support will pass it to Development and then we can allocate some time to make the required changes.

Best Regards,

Rob.

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [April 4, 2019, 5:48pm UTC](https://techcommunity.softwareag.com/t/data-archival-apis/203286/6 "2019-04-04T17:48:43Z")

</div>

Hi Rob,

I entered SR5366429 and copied the text from the Brainstorm request there.

Thanks again!

-Brian

---

<div class="post-metadata">

**Author:** ![Rob\_Jerome1](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@Rob\_Jerome1](https://techcommunity.softwareag.com/u/Rob_Jerome1)\
**Post date:** [April 4, 2019, 6:29pm UTC](https://techcommunity.softwareag.com/t/data-archival-apis/203286/7 "2019-04-04T18:29:03Z")

</div>

Hi Brian,

Thanks, we’ll keep you updated with progress on the change enhancement via the SR.

Best Regards,

Rob.

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [April 12, 2019, 9:23pm UTC](https://techcommunity.softwareag.com/t/data-archival-apis/203286/8 "2019-04-12T21:23:10Z")

</div>

Hi Rob,

Helen provided me with the updated Natural API, and it is perfect! It didn’t take me long to code what I wanted to do, and validating it’s results vs my spreadsheet for March’s totals (by action and grand total) showed a complete match.

Thanks so much for the enhancement request and the quick turnaround on it!!

-Brian

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [April 12, 2019, 10:18pm UTC](https://techcommunity.softwareag.com/t/data-archival-apis/203286/9 "2019-04-12T22:18:11Z")

</div>

```auto
/* ---------------------------------------------------------------------
/*                                                                      
/* THIS PROGRAM PROVIDES COUNTS FOR THE NUMBER OF RECORDS ARCHIVED      
/* THE PREVIOUS MONTH, TOTALLING BY ACTION AND A GRAND TOTAL.           
/*                                                                      
/* ---------------------------------------------------------------------
/* Notes:                                                               
/* 1. LFILE 152 must be set to the ADR configuration file               
/* ---------------------------------------------------------------------
DEFINE DATA                                                             
LOCAL USING ADRAPIL1                                                    
LOCAL USING ADRAPIP1                                                    
LOCAL                                                                   
/*                                                                      
1 #API-VERSION (B1) INIT <H'01'> /*ADR API Version 1 (must match ru
/*                                                                      
1 #ADRAPI-DATES (A8/1:2)                                          
1 #OUTPUT-LINE (A70)                                             
1 #ACTIVITY-ARRAY (A16/1:*)                                         
1 #DATX (D)                                               
1 #DATE (A8)                       
1 REDEFINE #DATE                                 
  2 #DATE-YYYY (A4)                       
  2 #DATE-MM (A2)                       
  2 #DATE-DD (A2)                       
1 #LEN (N10)                      
1 #M (P4)                       
1 #N (P4)                       
1 #ACTION-ARRAY (A32/1:250)                
1 #COUNT-ARRAY (N10/1:250)                
1 #O (P4)                       
1 #P (P4)                       
1 #TOTAL (N10)                      
END-DEFINE                                       
*                                                
SET GLOBALS LS=80                                
/ *********************************************** 
/* SET THE DATE RANGE FOR THE WHOLE PRIOR MONTH  
/ *********************************************** 
#DATX := *DATX                                
MOVE EDITED #DATX (EM=YYYYMMDD) TO #DATE               
MOVE '01' TO #DATE-DD                                  
MOVE EDITED #DATE TO #DATX (EM=YYYYMMDD)               
SUBTRACT 1 FROM #DATX                                  
MOVE EDITED #DATX (EM=YYYYMMDD) TO #DATE               
#ADRAPI-DATES(2) := #DATE                              
MOVE '01' TO #DATE-DD                                  
#ADRAPI-DATES(1) := #DATE                              
/ ****************************************              
/* GET ALL THE ACTIVITY IDS FOR THE MONTH              
/ ****************************************              
RESET ADRAPI-INTERFACE                                 
ADRAPI-VERSION := #API-VERSION                      
ADRAPI-FUNCTION := 'ACTIVITY-LIST'                   
ADRAPI-START-DATE := #ADRAPI-DATES(1) /* YYYYMMDD    
ADRAPI-END-DATE := #ADRAPI-DATES(2) /* YYYYMMDD    
/* --------------------------------------------------- 
/* Issue API call                                      
/* --------------------------------------------------- 
CALLNAT 'ADRAPI' ADRAPI-INTERFACE                      
IF ADRAPI-ERROR-CODE NE 0000                                    
  PRINT 'ERROR: ' ADRAPI-ERROR-CODE                             
  PRINT ADRAPI-ERROR-DESCRIPTION                                
  PRINT ADRAPI-ERROR-DESCRIPTION2                               
ELSE                                                            
  IF ADRAPI-ACTIVITIES-COUNT GT 0                               
    EXPAND ARRAY #ACTIVITY-ARRAY TO (1:ADRAPI-ACTIVITIES-COUNT) 
    SEPARATE ADRAPI-ACTIVITIES INTO                             
      #ACTIVITY-ARRAY(1:ADRAPI-ACTIVITIES-COUNT)                
      WITH DELIMITERS ',' GIVING NUMBER IN #N                   
  ELSE                                                          
    COMPRESS 'NO ARCHIVAL PROCESSES OCCURRED BETWEEN'           
      #ADRAPI-DATES(1) 'AND' #ADRAPI-DATES(2)                   
      INTO #OUTPUT-LINE                                         
    WRITE #OUTPUT-LINE                                          
  END-IF                                                        
END-IF                                                          
/* -------------------------------------------------------------
* GET THE DETAILS OF EACH EVENT                                 
/* -------------------------------------------------------------
IF #N > 0                                                          
  FOR #M = 1 TO #N                                                 
    RESET ADRAPI-INTERFACE                                         
    ADRAPI-VERSION := #API-VERSION                              
    ADRAPI-FUNCTION := 'ACTIVITY-INFO'                           
    ADRAPI-ACTIVITIES := #ACTIVITY-ARRAY(#M)                      
/* ---------------------------------------------------             
/* Issue API call                                                  
/* ---------------------------------------------------             
    CALLNAT 'ADRAPI' ADRAPI-INTERFACE                              
    IF ADRAPI-ERROR-CODE NE 0000                                   
      PRINT 'ERROR: ' ADRAPI-ERROR-CODE                            
      PRINT ADRAPI-ERROR-DESCRIPTION                               
      PRINT ADRAPI-ERROR-DESCRIPTION2                              
    ELSE                                                           
* /* DISPLAY THE RETURNED STATUS INFORMATION                     
      EXAMINE #ACTION-ARRAY(*) FOR ADRAPI-ACTION                   
        GIVING INDEX #O                                            
      IF #O NE 0                                                   
        #COUNT-ARRAY(#O) := #COUNT-ARRAY(#O) + ADRAPI-OVERALL-COUNT
      ELSE                                                        
        ADD 1 TO #P                                               
        #ACTION-ARRAY(#P) := ADRAPI-ACTION                        
        #COUNT-ARRAY(#P) := ADRAPI-OVERALL-COUNT                 
      END-IF                                                      
    END-IF                                                        
  END-FOR                                                         
*                                                                 
  FOR #O = 1 TO #P                                                
    DISPLAY 'ACTION' #ACTION-ARRAY(#O)                            
      'COUNT' #COUNT-ARRAY(#O)                                   
    ADD #COUNT-ARRAY(#O) TO #TOTAL                                
  END-FOR                                                         
END-IF                                                            
*                                                                 
WRITE 'TOTAL ARCHIVED FOR' #DATE-MM '/' #DATE-YYYY 'IS:' #TOTAL   
  // 'TOTAL NUMBER OF ARCHIVE ACTIVITIES = ' #N                   
*                                                                 
END                                                               
```

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [April 12, 2019, 10:22pm UTC](https://techcommunity.softwareag.com/t/data-archival-apis/203286/10 "2019-04-12T22:22:20Z")

</div>

```auto
             ACTION COUNT   
-------------------------------- -----------
                                            
ARCHIVE_SP_CHARGE_PROD_SUMMARY 0
ARCHIVE_SP_ADJUSTMENTS 30000000
ARCHIVE_SP_SUMMARY 0
ARCHIVE_SP_SUBLINE_SUMMARY 0
ARCHIVE_SP_RECAST_CHARGE_LINE 26875073
ARCHIVE_SP_RECAST_CHARGE_SUBLINE 23696466
ARCHIVE_SP_CHARGE_LINE_SUMMARY 3401509
Archive_FIN_TRANS_XREF 2687180
ARCHIVE_SP_MARKET_SUMMARY 0
ARCHIVE_SP_MRKT_SUBLINE_SUMMARY 15000000
Remove_PV_GV_Production 1069956
Remove_PV_US_Production 16040953
ARCHIVE_SP_MGR_SUMMARY 0
ARCHIVE_SP_MGR_PERF_TOTALS 0
ARCHIVE_SP_MGR_PERF 0
ARCHIVE_SP_BOOK_OVERRIDE 0
ARCHIVE_SP_MONTH_CLOSE 0
ARCHIVE_SP_SUMMARY_GOALS 0
                                            
TOTAL ARCHIVED FOR 03 / 2019 IS: 118771137
                                            
TOTAL NUMBER OF ARCHIVE ACTIVITIES = 340 
```

---

<div class="post-metadata">

**Author:** ![Rob\_Jerome1](https://avatars.discourse-cdn.com/v4/letter/r/85e7bf/32.png) [@Rob\_Jerome1](https://techcommunity.softwareag.com/u/Rob_Jerome1)\
**Post date:** [April 15, 2019, 12:24pm UTC](https://techcommunity.softwareag.com/t/data-archival-apis/203286/11 "2019-04-15T12:24:27Z")

</div>

Hi Brian,

You’re welcome, I’m pleased to hear that the update is working well for you.

Support will be in touch to confirm closure of the SR. The change has been committed so it will be included in the next 1.8.1 patch-level and future versions.

Best Regards,

Rob.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 3:42pm UTC](https://techcommunity.softwareag.com/t/data-archival-apis/203286/12 "2021-04-02T15:42:31Z")

</div>


