


Simplest would possibly be:
CHKTAP DEV(TAP04) VOL(MIMXBK) monmsg ( cpf6700 ) exec( return ) .../* Backup CL follows here... */...
The CHKTAP command will throw a CPF6720, CPF67E2 or some related CPF67xx exception if the volume mounted in TAP04 is not MIMXBK. If you don't want to continue, you can simply execute RETURN.
After the MONMSG command, the backup will run as long as MONMSG doesn't detect an error signal.
You could have it a little better with this:
CHKTAP DEV(TAP04) VOL(MIMXBK) monmsg ( cpf6700 ) exec( do ) .../* Send messages about the tape error... */... return enddo .../* Backup CL follows here... */...
By executing a DO-group, the MONMSG lets you code a series of CL commands before the RETURN. Even if you don't put anything in the DO-group other than RETURN, you should code it as a DO-group. That helps you later when you figure out what you want to do when the volume is wrong. The CPF67xx message will be in the joblog anyway.
A MONMSG command lets you handle errors at different points in your CL program. If there is no error, the CL continues with the next instruction. If you don't RETURN in the MONMSG code or exit in some other way, the CL will still go to the next command in your program.
Tom


…reads tape volume and executes the commands…
What should be read from the tape — labels, headers or files? What “commands” do you want to execute?
Please clarify what you want to do. What do you want to accomplish? What business problem are you trying to solve?
Tom
I have schedule CL prograt to take a backup on a daily basis, I need before start yhe backup to check the TAPE labele to verify it, if ok start backup else stop backup
…to check the TAPE labele to verify it…
What are you expecting to find? How will you know if the tape is the right one?
I assume that you will supply some value to your CL program. The program should then check the tape volume to see if it matches.
But what are you checking?
Generally, it is easy to check for the Volume identifier, a name of a File label or the date of a File label. Do you want to check more than that?
The CHKTAP command might be easy for you to use. There might be other possibilities if you need more.
Describe the values that you will have available. Maybe we can give an example.
Tom
Another command that cold be helpfull is DSPTAPCTG with output to a file.
But it all depends on what your situation is.
dears
i need IF statment to check as below the Tape Volume if MIMXBK continue the CL program to backup else dont continue and don’t backup
CHKTAP DEV(TAP04) VOL(MIMXBK)
What is the reason or need to check the label?
Thanks Tom.
it is working now.