View previous topic :: View next topic
|
Author |
Message |
harikiran.mc
New User
Joined: 18 Jan 2007 Posts: 17 Location: CHENNAI
|
|
|
|
Generally SAS program in the JCL gives a Return code at the end of the step. Inside the Step I think we can Modify the Return code.
I want to modify the Return code Value in the SAS, like forcing the abend while Testing.
Ex:- Move '8' to %SYSRC.
If anyone knows this please give me some syntax. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
I usually use this to return my own RC
Gerry |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
you can use
if you want the job to abend
Gerry |
|
Back to top |
|
|
abhishekmdwivedi
New User
Joined: 22 Aug 2006 Posts: 95 Location: india
|
|
|
|
hi,
You may use
Code: |
DATA _NULL_;
ABORT ABEND;
|
to abend your application OR
you may use
Code: |
DATA _NULL_;
ABORT 16;
|
or
Code: |
DATA _NULL_;
RC=16;
RETURN;
|
to return specific code to JCL, which can be used in the steps below the EXEC SAS. |
|
Back to top |
|
|
harikiran.mc
New User
Joined: 18 Jan 2007 Posts: 17 Location: CHENNAI
|
|
|
|
Hi Friends!! Thanks a lot for your replies!!!
Hi Abhishek!!
Can we send any message when we use the below syntax:
DATA _NULL_;
ABORT ABEND;
[/img] |
|
Back to top |
|
|
abhishekmdwivedi
New User
Joined: 22 Aug 2006 Posts: 95 Location: india
|
|
|
|
Well ABORT ABEND is an inbulit SAS function. It just abends the job abnormally.
For SAS System message :
You may use SYSMSG function. |
|
Back to top |
|
|
harikiran.mc
New User
Joined: 18 Jan 2007 Posts: 17 Location: CHENNAI
|
|
|
|
Sounds Good!! Thanks a Lot !! |
|
Back to top |
|
|
harikiran.mc
New User
Joined: 18 Jan 2007 Posts: 17 Location: CHENNAI
|
|
|
|
[quote]Hi !! If we Code the below statements, will it abend at that step and return to the JCL and proceeds next step ?
OR
Will it store 16 as return code and perform the next steps in SAS and @ End of SAS code program will terminate??
Code: |
DATA _NULL_;
RC=16;
RETURN;
[/quote] |
|
|
Back to top |
|
|
abhishekmdwivedi
New User
Joined: 22 Aug 2006 Posts: 95 Location: india
|
|
|
|
1) No it will not abend at that step it is used to make steps followed after the EXEC SAS to flush with COND=ONLY within JCL.
2) To abend in SAS code you have to use ABORT ABEND only at an DATA STEP and SAS will terminate immediatly with errored steps (including steps followed by the step having ABORT ABEND). |
|
Back to top |
|
|
Alan Voss
New User
Joined: 29 Nov 2006 Posts: 32 Location: Jacksonville, FL
|
|
|
|
abhishekmdwivedi wrote: |
1) No it will not abend at that step it is used to make steps followed after the EXEC SAS to flush with COND=ONLY within JCL. |
The above statement is not true. SAS will continue running and RC from SAS will still be 0.
You must use the ABORT statement to end SAS with a user provided return code. |
|
Back to top |
|
|
harikiran.mc
New User
Joined: 18 Jan 2007 Posts: 17 Location: CHENNAI
|
|
|
|
Can i use the following code:??
Code: |
DATA _NULL_;
RC=16;
RETURN;
/* THE ABOVE STEPS WILL MAKES RC TO HOLD THE RETURN CODE AS 16 /*
ABORT ABEND;
/* THIS ABORT STEP WILL ABEND AT THIS STEP AND RETURN TO JCL. SO RC OF THIS SAS STEP WILL BE 16/*
/* PLEASE CORRECT ME IF I'M WORNG/* |
|
|
Back to top |
|
|
harikiran.mc
New User
Joined: 18 Jan 2007 Posts: 17 Location: CHENNAI
|
|
|
|
OR JUST CAN I USE:???
[/code]
DATA _NULL_;
ABORT 16;
/* WILL THE ABOVE LINES OF CODE TERMINATE ABNORMLY AND STORES THE SAS STEP RC AS 16??/* |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
did anybody care to test before posting |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Enrico,
I can assure you I have tested what I stated, rarely I don't test the code that I provide.
Gerry |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
gcicchet wrote: |
Hi Enrico,
I can assure you I have tested what I stated, rarely I don't test the code that I provide.
Gerry |
Surely you must be tempted at some stage to supply untested code, just to see what happens |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
Hi Gerry,
I did not mean to put You in the same waste basket
it' s a pity that good answers get lost in the general noise
and too many people reply just to ... participate |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Expat,
I did say rarely
Gerry |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
/nastyness on
sometimes I provide the proper code, with slightly misleading comments
99% of the times nobody cares |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
I once recall giving an explanation and sample of the code to work from to get the solution, only to have the OP in question post back saying that it didn't work because my code had the incorrect field positions in it |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
Back to top |
|
|
abhishekmdwivedi
New User
Joined: 22 Aug 2006 Posts: 95 Location: india
|
|
|
|
My apologies for posting untested code.
And yes gcicchet you are right that SAS will return value 0 even if RC=16 with return is used within the SAS.
Thanks for correcting me. |
|
Back to top |
|
|
siva25
New User
Joined: 22 Jun 2007 Posts: 4 Location: bangalore
|
|
|
|
Could anyone please tell me the logic?
I want to modify the Return code Value in the SAS, like forcing the JOB abend while Testing.
My Requirement:
If the output file has only 1 record, then modify the return code, the job (SAS step) should end with a non-zero return code.
If the output file has more than 1 record, the job should end with zero return code.
Thanks in advance. |
|
Back to top |
|
|
|