Difference between revisions of "QTARTLBL - Retrieve Tape Label API"

From MidrangeWiki
Jump to: navigation, search
m (Phenrico moved page Retrieve Tape Label API to QTARTLBL - Retrieve Tape Label API: Prefer the API to show in the name)
 
Line 72: Line 72:
 
         When AeMsgID = *Blanks;                                     
 
         When AeMsgID = *Blanks;                                     
 
             p_TapeLabel = %subst(RtVolLabel:5:6);                   
 
             p_TapeLabel = %subst(RtVolLabel:5:6);                   
            SndCompMsg('Tape label is ' + %trim(p_TapeLabel));   
 
            p_ErrorCode = ' ';                                   
 
 
         When AeMsgID = 'CPF6772';                                   
 
         When AeMsgID = 'CPF6772';                                   
            SndCompMsg('Tape media unitialized');                 
 
 
             p_TapeLabel = '*UNINIT';                               
 
             p_TapeLabel = '*UNINIT';                               
            p_ErrorCode = 'CPF6772';                             
 
 
         Other;                                                     
 
         Other;                                                     
            SndCompMsg('Unknown error occurred. See MSGID '+     
 
                %trim(AeMsgID));                                 
 
 
             p_TapeLabel = '*UNKNOWN';                               
 
             p_TapeLabel = '*UNKNOWN';                               
            p_ErrorCode = %trim(AeMsgID);                         
 
 
         EndSl;                                                     
 
         EndSl;                                                     
 
    
 
    
Line 90: Line 83:
  
 
</pre>
 
</pre>
 +
 +
== 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 ==
 
== References ==
 
* [[ApiErrC — API Error Code]]
 
* [[ApiErrC — API Error Code]]

Latest revision as of 14:38, 29 March 2017

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