Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
absinthia,
step0100 gets the count from the table.
step0200 checks if the count from the table is zero. if it is indeed zero then a return code of 4 is set
step0300 will excuete if the return code of step0200 is zero and if the return code is 4 it will skip it
step0400 will excuete if the return code of step0200 is NOT zero and if the return code is 4 it will execute it
Now I want to use step TEST to unload table CM in order to dertermine
whether the table is blank or not . if blank,then go to step NORMAL,or
go to step ABNORM.
However,this method will request cpu cost because the table is not small.
So my question is :is there any other method that can implement the same function
Code:
//* TEST TABLE CM IF IT IS EMPTY */
//TEST EXEC PGM=IKJEFT01,
// DYNAMNBR=100
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DISP=SHR,DSN=BG04.DS.FIW.DB2UTIL(DSNTIAUL)
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSREC00 DD DSN=&&TEMP,
// DISP=(,PASS),
// UNIT=VTS,LABEL=(,SL,RETPD=010),VOL=(,,,9),
// MGMTCLAS=LMONTH,
// DCB=(RECFM=FB,LRECL=1,BLKSIZE=6000)
//SYSPUNCH DD SYSOUT=*,
// DCB=(RECFM=FB,LRECL=80)
//SYSIN DD DISP=SHR,DSN=EV604K.BG04.DS.FIW.DB2UTIL(UNLDCM)
//*IF NOT EMPTY,GO TO STEP010,ELSE THEN GO TO STEP015 */
//STEP1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=&&TEMP,DISP=(OLD,DELETE)
//TOOLIN DD *
COUNT FROM(IN) EMPTY
//CHK IF (STEP1.RC = 0 ) THEN
//NORMAL EXEC PGM=IEFBR14
//NEW1 DD DSN=EV604K.NORMAL.TEST,DISP=(,CATLG),SPACE=(TRK, (1,1)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=80)
// ELSE IF STEP1.RC = 12 THEN
//ABNORM EXEC PGM=IEFBR14
//NEW2 DD DSN=EV604K.ABNORM.TEST,DISP=(,CATLG),SPACE=(TRK,(1,1)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=80)
// ENDIF
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Quote:
Now I want to use step TEST to unload table CM in order to dertermine
whether the table is blank or not
I would suggest to use the following SQL instead of using COUNT(*) if your intention is to just determine if you have atleast one row in the table. This will consume least amount of cpu.
Code:
SELECT * FROM TABLE FETCH FIRST 1 ROW ONLY;
and change step0200 sysin control cards to the following