QTARTLBL - Retrieve Tape Label API

From MidrangeWiki
Revision as of 14:34, 29 March 2017 by Phenrico (talk | contribs) (Phenrico moved page Retrieve Tape Label API to QTARTLBL - Retrieve Tape Label API: Prefer the API to show in the name)
Jump to: navigation, search

Summary

The following is an extract of defining the parameters and using the IBM QTARTLBL API. This example is used to just retrieve information from the tape itself. Use the MSGID to determine corrections for issues

Prototype for the QMHSNDPM API


     D RtvTapeLabel    Pr                  ExtPgm( 'QTARTLBL' )            
     D  RtRcvVar                  32767a         Options( *VarSize )       
     D  RtRcvVarLen                  10i 0 Const                           
     D  RtFmtNam                      8a   Const                           
     D  RtTapNam                     10a   Const                           
     D  RtRqsVar                  32767a         Options( *VarSize )       
     D  RtRqsVarLen                  10i 0 Const                           
     D  RtError                   32767a         Options( *VarSize )       
                                                                           
      // Api Error Structure                                               
     D ApiError        Ds                                                  
     D  AeBytPro                     10i 0 Inz( %Size( ApiError ))         
     D  AeBytAvl                     10i 0 Inz                             
     D  AeMsgId                       7a                                   
     D                                1a                                   
     D  AeMsgDta                    128a                                   
                                                                           
      // Returned data structure                                           
     D RTData          DS                                     
     D  RtBytRtn                     10i 0                    
     D  RtBytAvl                     10i 0                    
     D  RtDevNam                     10a                      
     D  RtCartID                      6a                      
     D  RtVolLabel                   80a                      
     D  RtCode                        1a                      
     D  RtStdLabel                    1a                      
     D  RtLeadTapeMrk                 1a                      
     D  RtDensity                    10a                      
     D  RtReserved                    2a                      
     D  RtAddLabelEnt                 1a                      
     D  RtOffSet                     10i 0                    
     D  RtNbrLabelEnt                10i 0                    
     D  RtLenLabelEnt                10i 0                    
     D  RtLabelInfo               32767a                      
                                                              
      // Returned data structure - Label Info                 
     D RTLabel         DS                                     
     D  RtLabel1                     80a                      
     D  RtLabel2                     80a                   
     D  RtLogicalBlck                32a                   
     D  RtSeqNbr                     10a                   
     D  RtMulVolSeqNb                10a                   
     D  RtS36Type                     8A                   
     D                                                     
                                                           
      // Data structure - Request Qualifyers      
     D RtRqsQual       DS                                  
     D  RtRqsVol                      6A   inz(' ')        
     D  RtFileLabel                  17A   inz('*ALL')     
     D  RtSeqNbrStart                10A   inz('*FIRST')   
     D  RtSeqNbrEnd                  10A   inz('*ONLY')    
     D  RtEndOption                   1A   inz('0')        
     D  RtReserved2               32767A                   
                                                           
      *=============================== Main =========================
                                                                     
      /free                                                          
                                                                     
                                                                     
        // Call the API now                                        
        RtvTapeLabel(RtData:%size(RtDatA):'RLBL0100':p_TapeDrive:  
           RtRqsQual:44:APIError);                                 
        Select;                                                    
        When AeMsgID = *Blanks;                                    
            p_TapeLabel = %subst(RtVolLabel:5:6);                  
            SndCompMsg('Tape label is ' + %trim(p_TapeLabel));     
            p_ErrorCode = ' ';                                     
        When AeMsgID = 'CPF6772';                                  
            SndCompMsg('Tape media unitialized');                  
            p_TapeLabel = '*UNINIT';                               
            p_ErrorCode = 'CPF6772';                               
        Other;                                                     
            SndCompMsg('Unknown error occurred. See MSGID '+       
                %trim(AeMsgID));                                   
            p_TapeLabel = '*UNKNOWN';                              
            p_ErrorCode = %trim(AeMsgID);                          
        EndSl;                                                     
   

      /end-free                                                          
                                                                

References