MainframeSupports
tip week 13/2002:

Setting up reasonable return (or cond) codes in batch has cost a lot of trouble over the years. Especially return codes from TSO in batch can be difficult to handle. One thing is easy though and that is setting a return code of zero. This i acheived in the following way:

//TSOBATCH EXEC PGM=IKJEFT01
//SYSTSPRT DD SYSOUT=*
//SYSTSIN  DD *
    HDELETE 'MY.OWN.DATASET'
    CALL 'SYS1.LINKLIB(IEFBR14)'
/*

This example deletes a HSM migrated dataset called MY.OWN.DATASET. If the dataset isn't migrated the HDELETE fails with a nasty return code very different from zero. But who cares if it wasn't migrated, therefore we issue the command CALL 'SYS1.LINKLIB(IEFBR14)' which always will return zero as the return code (and do nothing else). This last return code is then passed to JES2 as the return code of this job step.

Program IEFBR14 is always located in the library SYS1.LINKLIB no matter what installation you are working on. If not the systems programmers at your site are particularly "clever".

Previous tip in english        Sidste danske tip        Tip list