Programming examples

The following examples are some examples of SDM API requests that you might issue, and the data that might be returned for these requests.
ANTRQST ILK=PPRC,REQUEST=PQUERY
The following application program will issue the ILK=PPRC request of REQUEST=PQUERY to get information on the established PPRC device of X'0F70'.
TITLE 'APIASM01 ANTRQST TEST PROGRAM'                          
APIASM01 CSECT ,                                                        
APIASM01 AMODE 31                                                       
APIASM01 RMODE ANY                                                      
@MAINENT DS    0H                                                       
         USING *,15                                                     
         B     @PROLOG                                                  
         DC    AL1(10)                                                  
         DC    C' APIASM01 '                                            
         DROP  15                                                       
@PROLOG  STM   14,12,12(13)     SAVE CALLER'S REGS IN HIS SAVEAREA      
         LR    12,15                                                    
@PSTART  EQU   APIASM01                                                 
         USING @PSTART,12                                               
*                                                                       
         LR    2,1              HOLD THE INPUT PARM PTR                 
         GETMAIN RU,LV=DYNLEN                                           
         LR    9,1                                                      
         USING DYNAREA,9                                                
         LA    3,MYSA                                                   
         USING SAVEAREA,13      ADDRESS CALLER'S SAVEAREA               
         ST    3,SA_NEXT        STORE MY SAVEAREA ADDRESS               
         DROP  13                                                       
         USING SAVEAREA,3       ADDRESS MY SAVEAREA                     
         ST    13,SA_PREVIOUS   STORE CALLER'S SAVEARE ADDRESS          
         DROP  3                                                        
         LR    13,3             PUT MY SAVEAREA ADDRESS IN R13          
*                                                                       
         ANTRQST ILK=PPRC,REQUEST=PQUERY,                              X
               DEVN=PDEVN,                                             X
               QRYSIZE=PQRYSIZE,QRYINFO=PQRYINFO,                      X
               FORMAT=PPQMAP,                                          X
               RETCODE=PRET,RSNCODE=PRSN,RETINFO=PRETINFO,             X
               MF=(E,PLIST)                                             
*                                                                      
         OPEN  (SNAPDCB,(OUTPUT))                                       
         LA    3,SNAPDCB                                                
         LA    4,STARTSNAP                                              
         LA    5,ENDSNAP                                                
         SNAP  DCB=(3),ID=1,STORAGE=((4),(5))                           
CLOSEIT  CLOSE SNAPDCB                                                  
*                                                                       
         LR    3,13            COPY MY SAVEAREA ADDRESS                 
         USING SAVEAREA,3      ADDRESS MY SAVEAREA                      
         L     13,SA_PREVIOUS  RESTORE CALLER'S SAVEAREA ADDRESS        
         DROP  3                                                        
         FREEMAIN RU,A=(9),LV=DYNLEN                                    
         LR    0,5             RESTORE OUR RESULTS                      
         LR    1,6             RESTORE OUR RESULTS                      
         LR    15,7            RESTORE OUR RESULTS                      
         L     14,12(,13)      RESTORE CALLER'S RETURN ADDRESS          
         LM    2,12,28(13)     RESTORE CALLER'S REGS 2-12               
         BR    14              RETURN TO THE CALLER                     
*                                                                       
*   STATIC DECLARES                                                     
*                                                                       
PDEVN       DC  XL2'0F70'                                               
PPQMAP      DC  CL6'PQMAP '                                             
PQRYSIZE    DC  H'2400'                                                 
XDVCBLOCK   DC  CL3'WP1'                                                
            PRINT OFF                                                   
            ANTRQSTL                                                    
SNAPDCB     DCB BLKSIZE=1632,DSORG=PS,LRECL=125,MACRF=(W),RECFM=VBA,   X
               DDNAME=SNAPDD                                            
            PRINT ON                                                    
*                                                                       
*   DYNAMIC AREA DECLARES                                               
*                                                                       
DYNLEN   EQU   DEND-DYNAREA                                             
            ANTPQMAP
DYNAREA  DSECT           
            DS    0F     
MYSA        DS    18F    
STARTSNAP   DS    0F     
PRET        DS    F      
PRSN        DS    F      
PMESSAGES   DS    F      
PRETINFO    DS    CL100  
PQRYINFO    DS    CL2400 
ENDSNAP     DS    0F     
DEND     EQU  *          
*                        
SAVEAREA DSECT           
SA_RESERVED  DS F        
SA_PREVIOUS  DS F        
SA_NEXT      DS F        
SA_R14       DS F        
SA_R15       DS F        
SA_R0        DS F        
SA_R1        DS F        
SA_R2        DS F        
SA_R3        DS F        
SA_R4        DS F        
SA_R5        DS F        
SA_R6        DS F        
SA_R7        DS F        
SA_R8        DS F        
SA_R9        DS F        
SA_R10       DS F        
SA_R11       DS F        
SA_R12       DS F        
*                        
MSGAREA  DSECT           
MSGSIZE  DS F            
*                        
         END             

The information returned by the SDM API for the ANTRQST request is shown as the following output:

PSW AT ENTRY TO SNAP    078D1000  80007D46  ILC  02  INTC  0033                                                       
-STORAGE                                                                                                                
0000659C                                                                 00001C4D      *                ...............(*
000065A0 00000960 00000000 00000000 00000000    00000000 00000000 00000000 00000000    *...-............................*
000065C0 00000000 00000000 00000000 00000000    00000000 00000000 00000000 00000000    *................................*
      LINE 000065E0  SAME AS ABOVE                                                                                      
00006600 C1D5E3D7 D8D4C1D7 01010000 00000960    00000000 00000000 00000000 00000000    *ANTPQMAP.......-................*
00006620 00000000 00000000 00000000 00000000    00000000 00000000 00000000 00000000    *................................*
00006640 0F700001 CA401104 F0F0F0F0 F0F0F0F0    F1F6F9F1 00000000 00000000 00000000    *..... ..000000001691............*
00006660 CA401104 0000F0F0 F0F0F0F0 F1F6F9F1    00000000 F1F30000 00000000 00000000    *. ....0000001691....13..........*
00006680 00000000 00000000 00000000 00000000    CA800005 F1F3F0F0 F0F0F0F0 F1F6F9F1    *....................130000001691*
000066A0 00010000 00000000 02000331 00130000    00000000 00000000 00000000 00000000    *................................*
000066C0 00000000 00000000 00000000 00000000    00000000 00000000 00000000 00000000    *................................*
000066E0 00000000 00000000 CAC00006 F1F3F0F0    F0F0F0F0 F1F6F9F1 00010000 00000000    *.........{..130000001691........*
00006700 03310200 00130000 00000000 00000000    00000000 00000000 00000000 00000000    *................................*
00006720 00000000 00000000 00000000 00000000    00000000 00000000 00000000 00000000    *................................*
00006740 CA800005 00000000 00000000 00000000    00010000 00000000 03300202 00170000    *................................*
00006760 00000000 00000000 00000000 00000000    00000000 00000000 00000000 00000000    *................................*
      LINES 00006780-000067C0  SAME AS ABOVE                                                                            
000067E0 00000000 00000000 00000000 00000000    00000000 00000000 00000000 0000C3A5    *..............................Cv*
00006800 00000000 00000000 00000000 00000000    00000000 00000000 00000000 00000000    *................................*
00006820 00000000 00000000 00000000 00000000    50050763 03FFC05F 00000000 00000000    *................&.....{.........*
00006840 50050763 03FFC05F 50050763 03FFC05F    50050763 04FFC441 00000000 00000000    *&.....{&.....{&.....D...........*
00006860 00000000 00000000 00000000 00000000    00000000 00000000 00000000 00000000    *................................*
      LINES 00006880-00006F40  SAME AS ABOVE                                                                            
00006F60 00000000                                                                      *....                            *

The storage area from X'0000659C' to X'000065FF' is the RETINFO area. The first four bytes, at offset X'0000659C', indicate the execution return code of X'00001C4D' which means that a PQUERY request was processed and that the size of the QRYINFO area (indicated by the value in the second full word of X'00000960') was sufficient to hold all of the information returned for the request.

The storage area from X'00006600' to X'00006F63' is the QRYINFO area which is mapped by the ANTPQMAP area (which is indicated by the first eight bytes of the QRYINFO area).

If you use the same application program , but having specified a device that was not available to the system, the SDM API returned the following information:

PSW AT ENTRY TO SNAP    078D1000  80007D46  ILC  02  INTC  0033                                                       
-STORAGE                                                                                                                
0000659C                                                                 00001C48      *                ................*
000065A0 00000008 43F2F0F1 C940D5D6 40E4C3C2    40C6D6E4 D5C440C6 D6D940C4 C5E5C9C3    *.....201I NO UCB FOUND FOR DEVIC*
000065C0 C540D5E4 D4C2C5D9 40E2D7C5 C3C9C6C9    C5C440C9 D540C9D5 D7E4E340 40404040    *E NUMBER SPECIFIED IN INPUT     *
000065E0 40404040 40404040 00000000 00000000    00000000 00000000 00000000 00000000    *        ........................*
00006600 00000000 00000000 00000000 00000000    00000000 00000000 00000000 00000000    *................................*
      LINES 00006620-00006F40  SAME AS ABOVE                                                                            
00006F60 00000000     

The storage area from X'0000659C' to X'000065FF' is the RETINFO area. The first four bytes, at offset X'0000659C', indicate the execution return code of X'00001C48' which indicate that an error was encountered executing the request. The description of this return code found in ANTRQSTL indicates that byte nine of the RETINFO area (X'43') has the length of the message which starts at byte ten (which is the message text for message ANTP0201I). The error is that a UCB was not found for the device specified on the request.