Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need to pass return code while copying

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
picus_mf
Warnings : 1

New User


Joined: 09 Jun 2006
Posts: 51

PostPosted: Mon Oct 13, 2008 2:31 pm    Post subject: Need to pass return code while copying
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: 8593
Location: Back in jolly old England

PostPosted: Mon Oct 13, 2008 2:33 pm    Post subject:
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    Post subject:
Reply with quote

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

Senior Member


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

PostPosted: Mon Oct 13, 2008 2:41 pm    Post subject:
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: 51

PostPosted: Mon Oct 13, 2008 3:44 pm    Post subject: @Sambhaji
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: 8593
Location: Back in jolly old England

PostPosted: Mon Oct 13, 2008 3:49 pm    Post subject:
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: 51

PostPosted: Mon Oct 13, 2008 3:53 pm    Post subject:
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

Senior Member


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

PostPosted: Mon Oct 13, 2008 3:58 pm    Post subject:
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

Senior Member


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

PostPosted: Mon Oct 13, 2008 3:59 pm    Post subject:
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: 1703
Location: Australia

PostPosted: Mon Oct 13, 2008 4:03 pm    Post subject:
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: 51

PostPosted: Mon Oct 13, 2008 4:10 pm    Post subject:
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: 1703
Location: Australia

PostPosted: Mon Oct 13, 2008 5:29 pm    Post subject:
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 Moderator


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

PostPosted: Mon Oct 13, 2008 9:33 pm    Post subject:
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: 2158
Location: @my desk

PostPosted: Tue Oct 14, 2008 9:59 am    Post subject:
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 Moderator


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

PostPosted: Tue Oct 14, 2008 9:30 pm    Post subject:
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: 2158
Location: @my desk

PostPosted: Tue Oct 14, 2008 9:38 pm    Post subject:
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 Moderator


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

PostPosted: Tue Oct 14, 2008 9:57 pm    Post subject:
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: 1703
Location: Australia

PostPosted: Wed Oct 15, 2008 3:48 am    Post subject:
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 Moderator


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

PostPosted: Wed Oct 15, 2008 4:04 am    Post subject:
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: 51

PostPosted: Mon Oct 20, 2008 12:33 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts PL/I code tuning/Performance improvement Virendra Shambharkar PL/I & Assembler 3 Mon Dec 05, 2016 11:57 am
No new posts What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am
No new posts IDEAL - Code Retrieval yugendran CA Products 0 Fri Nov 25, 2016 3:27 pm
No new posts DFHWS2LS return value divated CICS 4 Mon Nov 07, 2016 5:44 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us