TechTalk: Rewind by Remote Control

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

All OS/400 commands that support tape devices offer the ENDOPT parameter, which can have the values *LEAVE, *REWIND or *UNLOAD. When the same tape has to be processed repeatedly, one usually selects the *LEAVE option, either manually or in a CL program. This saves time, wear and tear and since the tape does not rewind after each use.

Once in awhile, however, the tape is left in the middle with the next operation expecting it to be rewound. For example, you could have a loop in a CL program that saves a number of objects to a tape using ENDOPT(*LEAVE) for an unknown number of objects. After the last object is saved, you need to display the contents of the tape to a printer--which expects the tape to be rewound.

The Rewind Tape command (RWDTAP) solves this problem. It only needs to know the name of the tape device and whether you want to rewind or unload. It accomplishes its objective by using the CHKTAP command with no special parameters except ENDOPT. See the command and program in Figures 5a and 5b.


TechTalk: Rewind by Remote Control

Figure 5A Command RWDTAP

 RWDTAP: CMD PROMPT('Rewind Tape') PARM KWD(DEV) TYPE(*NAME) LEN(10) MIN(1) + PROMPT('Device name') PARM KWD(UNLOAD) TYPE(*CHAR) LEN(4) RSTD(*YES) + DFT(*NO) VALUES(*YES *NO) PROMPT('Unload + tape after rewinding') 
TechTalk: Rewind by Remote Control

Figure 5B CL program TAP002CL

 TAP002CL: + PGM PARM(&DEV &UNLOAD) DCL VAR(&DEV) TYPE(*CHAR) LEN(10) DCL VAR(&ENDOPT) TYPE(*CHAR) LEN(7) DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(80) DCL VAR(&MSGF) TYPE(*CHAR) LEN(10) DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10) DCL VAR(&MSGID) TYPE(*CHAR) LEN(7) DCL VAR(&UNLOAD) TYPE(*CHAR) LEN(4) IF COND(&UNLOAD *EQ '*YES') THEN(CHGVAR VAR(&ENDOPT) + VALUE(*UNLOAD)) ELSE CMD(CHGVAR VAR(&ENDOPT) VALUE(*REWIND)) CHKTAP DEV(&DEV) ENDOPT(&ENDOPT) MONMSG MSGID(CPF0000) EXEC(DO) RCVMSG MSGTYPE(*EXCP) RMV(*NO) MSGDTA(&MSGDTA) MSGID(&MSGID) + MSGF(&MSGF) MSGFLIB(&MSGFLIB) SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) MSGDTA(&MSGDTA) + MSGTYPE(*DIAG) SNDPGMMSG MSGID(CPF0002) MSGF(QCPFMSG) MSGTYPE(*ESCAPE) ENDDO ENDPGM 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: