View previous topic :: View next topic
|
Author |
Message |
picus_mf Warnings : 1 New User
Joined: 09 Jun 2006 Posts: 52
|
|
|
|
Hi,
I have to copy one old file to another new file. This new file will be given as input to an immediate step. Before this file is used further I would like to restrict the execution of the step if the new file contain no records. Please advise me.
The two files will be PS files.
Thanks, |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
This topic has been discussed many times.
There is a SEARCH button at the top of the page - please use it |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Hi,
- Check the "new file" if it is Empty using IDCAMS or SORT in the subsequent step which creates the "new file".
- Check the return code of this (above one) step with the help of COND, in the step which you want to CONDitionally excute. |
|
Back to top |
|
|
picus_mf Warnings : 1 New User
Joined: 09 Jun 2006 Posts: 52
|
|
|
|
I tried doing this
Code: |
With IDCAMS
//INDD DD DSN=INPUT FILE,DISP=SHR
//OUTDD DD DSN=OUTPUT FILE,DISP=SHR
//SYSIN DD *
REPRO INFILE(INDD) OUTFILE(OUTDD) COUNT(1)
/*
IF THE FILE IS EMPTY IT WILL SET RC=04
|
I am getting return code of 20.
In the spool I got this message
Code: |
IEF142I U131591R STEP001 - STEP WAS EXECUTED - COND CODE 0020 |
|
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
What does SYSPRINT output tell you ? |
|
Back to top |
|
|
picus_mf Warnings : 1 New User
Joined: 09 Jun 2006 Posts: 52
|
|
|
|
Code: |
//STEP001 EXEC PGM=ICETOOL
//INDD DD DISP=SHR,DSN=X12345.SRTFILE
//OUTDD DD DSN=X12345.SORT.SAMPLE.T03,
// DISP=(NEW,CATLG,DELETE),
// DCB=(LRECL=80,BLKSIZE=800,RECFM=FB),
// SPACE=(TRK,(5,15),RLSE),UNIT=SYSDA
//SYSIN DD *
REPRO INFILE(INDD) OUTFILE(OUTDD) COUNT(1)
/*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=* |
No SYSPRINT messages are displayed. Only the JESMSGLG, JESJCL and JESYSMSG are printed. I could see no messages showing the error. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Quote: |
I am getting return code of 20. |
Why don't try with PRINT command?
Code: |
PRINT INFILE(IN) COUNT(1) |
|
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
Hello,
You EXECuted ICETOOL with REPRO ? |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
you are using ICETOOL and not IDCAMS.
Gerry |
|
Back to top |
|
|
picus_mf Warnings : 1 New User
Joined: 09 Jun 2006 Posts: 52
|
|
|
|
Nope, its not ICETOOL. Its IDCAMS I used. I am sorry for putting it wrongly.
Here I want to copy the file and then check for if it is an empty file. Can I do it in a single step like
a. copy the file
b. using the COND, decide to proceed with this step or not.
I may not allowed to used extra steps in the JCL. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
you can try this
Code: |
//STEP0001 EXEC PGM=IDCAMS
//INPUT DD *
1
2
3
//FIRSTREC DD SYSOUT=*
//OUTPUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
REPRO INFILE(INPUT) OUTFILE(FIRSTREC) COUNT(1)
IF LASTCC = 0 THEN DO
REPRO INFILE(INPUT) OUTFILE(OUTPUT)
END
|
Gerry |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
picus_mf,
Here's a DFSORT job that will set RC=4 for an empty input file or RC=0 for a non-empty input file:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY,NULLOUT=RC4
/*
|
|
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
picus_mf,
Alternately, you can specify this parameter in the PARM also, for better readability.
Code: |
//STEP1 EXEC PGM=ICEMAN,PARM='NULLOUT=RC4'
..............
..............
//SYSIN DD *
OPTION COPY
|
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
How does the PARM give "better readability"?
PARM options appear in the JCL source, but are NOT listed in //SYSOUT.
Inline OPTION options appear in the JCL source and are also listed in //SYSOUT. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
How does the PARM give "better readability"? |
I believe it gives a better understanding of the job (that this step issues RC=4 when input is empty) without seeing the control cards or without even submitting the job. Again it is my personal opinion. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
I personally would go with the control card so I could see it in //SYSOUT when the job is run. But I guess that's for each person to decide for themselves. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
why not have the parm options displayed in the SYSOUT ? Surely it would help seeing the parm parameters in the SYSOUT. They are performing the same functions as the control cards.
I know I might be side tracking, but an invalid parameter passed via the PARM still returns a 0 return code but the same parameter via control card abends the job
Code: |
//SORTIT1 EXEC PGM=SORT,PARM='SKIPREZ=2,STOPAFT=2'
|
The above returns a 0 rc with the following message. Also it ignores the invalid parameter and performs the second function.
Code: |
ICE067I 0 INVALID PARAMETER IN JCL EXEC PARM OR INVOKED PARM LIST
|
On the other hand the following abends the job
Code: |
OPTION COPY,SKIPREZ=2,STOPAFT=2
|
Code: |
OPTION COPY,SKIPREZ=2,STOPAFT=2
$
ICE095A 0 INVALID OPTION STATEMENT OPERAND
|
Gerry |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
If you want to see your PARM options in //SYSOUT, you can specify them in //DFSPARM instead of in the EXEC statement, like so:
Code: |
//DFSPARM DD *
VLSHRT,STOPAFT=5 <----- PARM options
OPTION COPY,SKIPREC=2,VLSCMP <---- control statement
/*
|
In the above //DFSPARM data set, VLSHRT and STOPAFT=5 are treated as PARM options (same as if they were specified in the EXEC statement).
SKIPREC=2 and VLSCMP are treated as OPTION options.
An invalid PARM option in the EXEC statement or in DFSPARM is ignored with an informational message so you get RC=0.
An invalid OPTION option results in an error message and termination so you get RC=16.
It's been like this for decades. |
|
Back to top |
|
|
picus_mf Warnings : 1 New User
Joined: 09 Jun 2006 Posts: 52
|
|
|
|
Thanks alot for the replies.
I used the below one
Code: |
OPTION COPY,NULLOUT=RC4
|
Thanks Frank. |
|
Back to top |
|
|
|