Page 1 of 1

Is IDCAMS command will be executed unconditionally?

PostPosted: Wed Jul 30, 2014 9:05 am
by hihui
Hi guy,
I want to know wheter an IDCAMS command willl always be executed even if its previous command get an error ?

//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=A
//SYSIN DD *
IDCAMS_CMD1 ...
IDCAMS_CMD2 ...
/*

For example, IDCAMS_CMD2 ... will always be executed, whatever the result of its previous command IDCAMS_CMD1, success or failure ?

Re: Is IDCAMS command will be executed unconditionally?

PostPosted: Wed Jul 30, 2014 12:01 pm
by BillyBoyo
I suggest that you consult the manual and many examples you can locate with a search engine. If you code it without conditions, it will be unconditional. If you code it with conditions, it will be conditional.

Re: Is IDCAMS command will be executed unconditionally?

PostPosted: Wed Jul 30, 2014 1:00 pm
by hihui
BillyBoyo wrote:I suggest that you consult the manual and many examples you can locate with a search engine. If you code it without conditions, it will be unconditional. If you code it with conditions, it will be conditional.


Thanks for you replay; yes I coded it without LASTCC/MAXCC condition.
I had written a simple JCL
//TESTIDCC JOB CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1),NOTIFY=&SYSUID
//*-----------------------------------------------------------------
//STEP01 EXEC PGM=IDCAMS
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSIN DD *
ALLOCATE DATASET('MYID.TEST.DATA1') -
LRECL(80) -
RECFM(V B) -
BLKSIZE(800) -
SPACE(1,1) -
CYL
ALLOCATE DATASET('MYID.TEST.DATA2') -
LRECL(80) -
RECFM(V B) -
BLKSIZE(800) -
SPACE(1,1) -
CYL
/*

When there is a MYID,TEST.DATA1 dataset ,but not MYID.TEST.DATA2; so the first command in the job card will failure, but it seems the second command is executed successfully.
This is different behavior compared with shell script on an unix platform, where a command failure will cause the script to exit immediately, but IDCAMS seems will continue to execute.
so I wish to confirm this, because i couldn't find the explicit statement from IDCAMS manual document.

Re: Is IDCAMS command will be executed unconditionally?

PostPosted: Wed Jul 30, 2014 1:46 pm
by enrico-sorichetti
This is different behavior compared with shell script on an unix platform,

shell scripting has its rules IDCAMS has others ... nothing more nothing less

Re: Is IDCAMS command will be executed unconditionally?

PostPosted: Wed Jul 30, 2014 2:50 pm
by BillyBoyo
As enrico said, there are rules for IDCAMS and rules for other things. Any intersection of rules need be considered no more than coincidence.

If IDCAMS came to a halt with an operation that got a non-zero value, then there would be no point in IDCAMS having an IF, would there?

You've seen how it operates. Why would you question it? I'm sure it is documented, but I don't see much point in locating the reference.

If you don't want something to run when something else has not given the expected return, then you use IF. It is simple.

The rules which relate to banana skins and apple skins are not the same (how you take them off, whether human-edible). Still, they are fruit. It is something we get over all the time, and no real biggie.