View previous topic :: View next topic
|
Author |
Message |
pkmurali Warnings : 1 Active User

Joined: 15 Dec 2005 Posts: 271
|
|
|
|
Hi,
In my COBOL program, i have to error out the program by populating Return-Code register with value of '1000',
so that i can trigger a mail in JCL with RC = 1000. to achieve the above condition, it's enough to populate return-code register with '1000'? Please clarify.
Thanks,
Murali |
|
Back to top |
|
 |
Robert Sample
Global Moderator

Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
The manual isn't clear enough? See the manuals link at the top of the page. |
|
Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
 |
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
A "STOP" , or "STOP RUN" afterwards would help. |
|
Back to top |
|
 |
Bill O'Boyle
CICS Moderator

Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
In as much as COBOL defines this as a "REGISTER" (really a misnomer), the compiler treats it as a signed binary-halfword, which has a maximum signed positive value of +32767.
However, there should not be any problem with a value of +1000.
Regards, |
|
Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Craq Giegerich wrote: |
A "STOP" , or "STOP RUN" afterwards would help. |
a GOBACK would suffice, also. |
|
Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
For a bit of entertainment/education, try:
Code: |
MOVE 4444 TO RETURN-CODE.
GOBACK. |
|
|
Back to top |
|
 |
pkmurali Warnings : 1 Active User

Joined: 15 Dec 2005 Posts: 271
|
|
|
|
I used the Below piece of code in Pgm and
Code: |
MOVE '04' TO RETURN-CODE
MOVE 'Data Err in App-def:'
TO ERROR-ERR-DESC(1:19)
PERFORM Z1000-DISP-ERR-INFO
THRU Z1000-EXIT
PERFORM Z9999-EXIT-PROGRAM
THRU Z9999-EXIT
.
.
Z9999-EXIT-PROGRAM.
STOP RUN.
Z9999-EXIT.
EXIT.
|
In Jcl
Code: |
//*EXECUTION OF PROGRAM
//P243CA02 EXEC PGM=IKJEFT1A,TIME=800
.
.
// IF P243CA02.RC<4 THEN
//P243BA02 EXEC PGM=IEBGENER,TIME=800
//*
//SYSUT1 DD DSN=R243PB.EPC.P7932.EPC.MAILHEAD.COMMON,
// DISP=SHR
// DD DSN=R243PB.EPC.M243CA10.ERRLOG,
// DISP=SHR
//* DD DSN=R243PB.EPC.P7932.EPC.MAILTRLR.P243CA1S,
//* DISP=SHR
//*
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSIN DD DUMMY,DCB=BLKSIZE=80
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
// ENDIF
// IF P243CA01.RC=4 THEN
//P243BA03 EXEC PGM=IEBGENER,TIME=800
//*
//SYSUT1 DD DSN=R243PB.EPC.P7932.EPC.MAILHEAD.ERROR,
// DISP=SHR
// DD DSN=R243PB.EPC.M243CA10.ERRLOG,
// DISP=SHR
//*
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSIN DD DUMMY,DCB=BLKSIZE=80
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
// ENDIF
|
my JESMSGLG is
Code: |
-J243CA1 P243CA02 04 672 779 .00
-J243CA1 P243BA02 FLUSH 0 0 .00
-J243CA1 P243BA03 FLUSH 0 0 .00 |
Please let me know why after execution of my program, the Job is not picking up my RC.
Thanks,
Murali |
|
Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
code correctly:
// IF P243CA01.RC=4 THEN |
|
Back to top |
|
 |
pkmurali Warnings : 1 Active User

Joined: 15 Dec 2005 Posts: 271
|
|
|
|
Thanks,
Dick |
|
Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
I still believe something could be learned from this. . . .
Quote: |
For a bit of entertainment/education, try:
Code: |
MOVE 4444 TO RETURN-CODE.
GOBACK. |
|
Hint: the return code will NOT be 4444. . . |
|
Back to top |
|
 |
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Hi Dick,
I got RC as 0348. Wondering...  |
|
Back to top |
|
 |
Robert Sample
Global Moderator

Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
RC=0348 is expected .... |
|
Back to top |
|
 |
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Hi Robert,
Could you please explain it? |
|
Back to top |
|
 |
Robert Sample
Global Moderator

Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
A return code is only allowed in the range of 0 to 4095; this limit is mentioned in the JCL Language Reference several times. If a return code greater than 4095 is set, the system reduces it using modulus arithmetic (4096).
4444 - 4096 = 0348, so the return code set in COBOL at 4444 becomes 0348 as far as JES and z/OS are concerned. |
|
Back to top |
|
 |
Aaru
Senior Member

Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Hi Robert,
Strange but a very good point.
Quote: |
If a return code greater than 4095 is set, the system reduces it using modulus arithmetic (4096).
|
If I move 4096 to the RETURN-CODE register then will 0 get moved to the same after using modulus arithmetic?
If yes, we should be very careful as RETURN-CODE zero is fine. |
|
Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Yes, 4096 will cause a return-code zero. . .
Which is why the experiment was suggested. . . .  |
|
Back to top |
|
 |
Aaru
Senior Member

Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Hi Dick,
Quote: |
Which is why the experiment was suggested. . . . |
Thanks and we welcome all your experiments  |
|
Back to top |
|
 |
Robert Sample
Global Moderator

Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Aaru: when doing batch FTP with the EXIT parameter, this becomes relevant as FTP errors set the return code as a 5-digit number: 2 digits for the FTP command being executed (16 for GET and 27 for PUT, for example) followed by the 3-digit response code from the server. A common code is 16550, which occurs when you attempt to GET a file that isn't there. The 16550 turns into a 0166 return code for the job step due to modulus arithmetic. |
|
Back to top |
|
 |
Aaru
Senior Member

Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Hi Robert,
That was indeed a good information. Will keep this in mind.
Thanks a ton. |
|
Back to top |
|
 |
|