TechTalk: Automatic Tape Label Type Processing

System Administration
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

Let's say you are receiving a variety of tapes, all of which must be loaded to your AS/400 using the Copy From Tape (CPYFRMTAP) command. Some of the tapes are nonlabeled, some use labels, still others use nonstandard labels. The CPYFRMTAP command requires that you supply the correct value for the label processing type as part of the copy from reels (FROMREELS) parameter?*NL for nonlabeled tapes, *SL for standard labels, or *BLP (bypass label processing) for non-standard labels.

If you specify an incorrect value in the FROMREELS parameter, the system issues message CPA4158. You can manually determine the correct value by repeatedly running either the CPYFRMTAP command?using different values in the FROMREELS parameter each time or the Dump Tape (DMPTAP) command. Both processes are trial and error. By using a CL program similar to the one illustrated in 2 (see page 68), however, you can eliminate the manual intervention.

If you specify an incorrect value in the FROMREELS parameter, the system issues message CPA4158. You can manually determine the correct value by repeatedly running either the CPYFRMTAP command?using different values in the FROMREELS parameter each time or the Dump Tape (DMPTAP) command. Both processes are trial and error. By using a CL program similar to the one illustrated in Figure 2 (see page 68), however, you can eliminate the manual intervention.

You might think that all you need to do is to try each of the FROMREELS values in turn, monitoring for CPA4158 until you get it right. That method won't work because CPA4158 goes to the system operator message queue (QSYSOPR) and it cannot be monitored by the Monitor Message (MONMSG) command. However, replying to CPA4158 with a C (cancel) results in message CPF2952, which can be monitored. Of course, you don't want to confuse your operator with C responses that don't cancel jobs, so you need to make this reply automatic. Since the default message reply to CPA4158 is C, use the Change Job (CHGJOB) command to change the inquiry message reply value to *DFT (default).

CHGJOB INQMSGRPY(*DFT)

This technique creates a problem. The job will automatically respond to other messages with their default replies.

The solution is to temporarily add CPA4158 to the system reply list from within the CL program. By finding the first available entry on the system reply list (the system issues CPF2555 if a system reply list sequence number is in use), the program can add the reply list entry and then remove it once it is no longer needed. The code in 2 illustrates the method just described.

The solution is to temporarily add CPA4158 to the system reply list from within the CL program. By finding the first available entry on the system reply list (the system issues CPF2555 if a system reply list sequence number is in use), the program can add the reply list entry and then remove it once it is no longer needed. The code in Figure 2 illustrates the method just described.

-J.D. Hunt


TechTalk: Automatic Tape Label Type Processing

Figure 2: Code for Automatic Tape Label Type Processing

 PGM DCL VAR(&INQMSGRPY) TYPE(*CHAR) LEN(10) DCL VAR(&SEQNBR) TYPE(*DEC) LEN(4 0) VALUE(0) RTVJOBA INQMSGRPY(&INQMSGRPY) CHGJOB INQMSGRPY(*SYSRPYL) TRYSEQ: CHGVAR VAR(&SEQNBR) VALUE(&SEQNBR + 1) ADDRPYLE SEQNBR(&SEQNBR) MSGID(CPA4158) RPY('C') MONMSG MSGID(CPF2555) EXEC(GOTO CMDLBL(TRYSEQ)) TRYSL: CPYFRMTAP FROMFILE(QTAPE) TOFILE(XXX/tgt_file) + FROMREELS(*SL) MBROPT(*REPLACE) MONMSG MSGID(CPF2952) EXEC(GOTO CMDLBL(TRYNL)) GOTO CMDLBL(DONE) TRYNL: CPYFRMTAP FROMFILE(QTAPE) TOFILE(XXX/tgt_file) + FROMREELS(*NL) MBROPT(*REPLACE) MONMSG MSGID(CPF2952) EXEC(GOTO CMDLBL(TRYBLP)) GOTO CMDLBL(DONE) TRYBLP: CPYFRMTAP FROMFILE(QTAPE) TOFILE(XXX/tgt_file) + FROMREELS(*BLP) MBROPT(*REPLACE) DONE: RMVRPYLE SEQNBR(&SEQNBR) CHGJOB INQMSGRPY(&INQMSGRPY) ENDPGM: ENDPGM 
BLOG COMMENTS POWERED BY DISQUS