IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need to pass return code while copying


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
picus_mf
Warnings : 1

New User


Joined: 09 Jun 2006
Posts: 52

PostPosted: Mon Oct 13, 2008 2:31 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Mon Oct 13, 2008 2:33 pm
Reply with quote

This topic has been discussed many times.

There is a SEARCH button at the top of the page - please use it
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Oct 13, 2008 2:39 pm
Reply with quote

Check this
www.ibmmainframes.com/post-9311.html
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Mon Oct 13, 2008 2:41 pm
Reply with quote

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
View user's profile Send private message
picus_mf
Warnings : 1

New User


Joined: 09 Jun 2006
Posts: 52

PostPosted: Mon Oct 13, 2008 3:44 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Mon Oct 13, 2008 3:49 pm
Reply with quote

What does SYSPRINT output tell you ?
Back to top
View user's profile Send private message
picus_mf
Warnings : 1

New User


Joined: 09 Jun 2006
Posts: 52

PostPosted: Mon Oct 13, 2008 3:53 pm
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Mon Oct 13, 2008 3:58 pm
Reply with quote

Quote:
I am getting return code of 20.

Why don't try with PRINT command?
Code:
PRINT INFILE(IN) COUNT(1)
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Mon Oct 13, 2008 3:59 pm
Reply with quote

Hello,

You EXECuted ICETOOL with REPRO ?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon Oct 13, 2008 4:03 pm
Reply with quote

Hi,

you are using ICETOOL and not IDCAMS.

Gerry
Back to top
View user's profile Send private message
picus_mf
Warnings : 1

New User


Joined: 09 Jun 2006
Posts: 52

PostPosted: Mon Oct 13, 2008 4:10 pm
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon Oct 13, 2008 5:29 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Oct 13, 2008 9:33 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Oct 14, 2008 9:59 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Oct 14, 2008 9:30 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Oct 14, 2008 9:38 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Oct 14, 2008 9:57 pm
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Oct 15, 2008 3:48 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Oct 15, 2008 4:04 am
Reply with quote

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
View user's profile Send private message
picus_mf
Warnings : 1

New User


Joined: 09 Jun 2006
Posts: 52

PostPosted: Mon Oct 20, 2008 12:33 pm
Reply with quote

Thanks alot for the replies.

I used the below one
Code:

OPTION COPY,NULLOUT=RC4

Thanks Frank.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts purge jobs with return code 0 and ret... JCL & VSAM 4
No new posts Is this possible via sort (in one pass)? SYNCSORT 4
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
Search our Forums:

Back to Top