QTARTLBL - Retrieve Tape Label API

From MidrangeWiki
Revision as of 09:38, 29 March 2017 by Phenrico (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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);                  
        When AeMsgID = 'CPF6772';                                  
            p_TapeLabel = '*UNINIT';                               
        Other;                                                     
            p_TapeLabel = '*UNKNOWN';                              
        EndSl;                                                     
   

      /end-free                                                          
                                                                

Message ID's

You can check for the following message ID's:


Blank / No error – No issue found.  The program should have returned a tape label 
CPF6760 – Tape drive not ready.  The tape drive is varied on, but no tape is loaded
CPF6772 – Volume cannot be processed – Tape is loaded, but it has not been initialized yet. Run INZTAP on it.
CPF673A – Tape drive not varied on. Tape drive should be in status VARIED ON for the process to work.
If you receive a different message id, run command DSPMSGD CPFxxxxx to see what the error is, and act on it.


References