|
|
| Author |
Message |
Absinthia
New User
Joined: 10 Jan 2008 Posts: 27 Location: CHINA
|
|
|
|
I have two selections to go depending on record number of table A.
If record number is zero ,then go to step1.if not ,go to step2.
However,it is not permitted to unload table A to determine the number because of cpu cost.(table A is a little bigger).
How can I implement it ?
Using SQL [select count(*) from A] seems to work,but i don't know the details in JCL. |
|
| Back to top |
|
 |
References
|
|
 |
superk
Moderator Team Head
Joined: 26 Apr 2004 Posts: 3381 Location: Charlotte,NC USA
|
|
|
|
| What does this have to do with either DFSORT or JCL? |
|
| Back to top |
|
 |
Absinthia
New User
Joined: 10 Jan 2008 Posts: 27 Location: CHINA
|
|
|
|
superk,
I just want to implement the function with JCL. I wonder whether DFSORT can do it.
the result (record number)of select count(*) from A can be only contained in a PS,and the type is hex. |
|
| Back to top |
|
 |
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1024 Location: Bangalore,India
|
|
|
|
Hello Absinthia,
| Quote: |
If record number is zero ,then go to step1.if not ,go to step2.
However,it is not permitted to unload table A to determine the number because of cpu cost.(table A is a little bigger).
How can I implement it ?
Using SQL [select count(*) from A] seems to work,but i don't know the details in JCL. |
Your requirement is not clear & what do you mean by record number?
Could you please put it more clear form to enable us to provide solution. |
|
| Back to top |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 399 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
| Code: |
//STEP0100 EXEC PGM=IKJEFT01
//SYSTSPRT DD SYSOUT=*,DCB=BLKSIZE=121
//SYSPRINT DD SYSOUT=*
//SYSTSIN DD *
DSN SYSTEM(xxxx)
RUN PROGRAM(DSNTIAUL) -
PLAN(DSNTIAUL) -
PARMS('SQL') -
LIB('DB2T.RUNLIB.LOAD')
//SYSREC00 DD DSN=userid.UNLOAD.count,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(TRK,(1,1),RLSE)
//SYSPUNCH DD SYSOUT=*
//SYSIN DD *
SELECT COUNT(*) FROM TABLE;
/*
//STEP0200 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=userid.UNLOAD.count,DISP=SHR
//SORTOUT DD DUMMY
//SYSIN DD *
OPTION NULLOUT=RC4
INCLUDE COND=(1,4,BI,EQ,0)
SORT FIELDS=COPY
/*
//STEP0300 EXEC PGM=URPGM,COND=(4,EQ,STEP0200)
...
//STEP0400 EXEC PGM=URPGM,COND=(0,EQ,STEP0200)
|
Hope this helps...
Cheers |
|
| Back to top |
|
 |
Absinthia
New User
Joined: 10 Jan 2008 Posts: 27 Location: CHINA
|
|
|
|
Hi,guptae.
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 |
|
|
| Back to top |
|
 |
Absinthia
New User
Joined: 10 Jan 2008 Posts: 27 Location: CHINA
|
|
|
|
hi,Skolusu
Thanks very much,that is what i wanted.
I greatly appreciate your help.
guptae,superk.
thank you all the same.  |
|
| Back to top |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 399 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
| Code: |
/SYSIN DD *
OPTION NULLOUT=RC4
SORT FIELDS=COPY
/* |
Hope this helps...
Cheers |
|
| Back to top |
|
 |
|
|
|