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

Cobol Sort return code of 20- Clarification needed


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
chan2004

New User


Joined: 28 Mar 2007
Posts: 16
Location: India

PostPosted: Thu Apr 05, 2007 10:29 am
Reply with quote

Hi,
today i wrote a simple sort program.
something like his:-
0000-MAINLINE.
--------------------------------------------------------------*

DISPLAY 'HI'. ----------- stmnt 1
SORT TEMPFILE ON DESCENDING KEY MARITAL1 ----------- sort stmt
ASCENDING GENDERPIC1
ASCENDING EMPLOYEE-FNAME1
USING INPUT-FILE
what i noticed was if i don't put any statement before sort stmt,it gives a sort return code of 20.but if i put any statement like stmnt 1,it will work fine
why is it like that?

also,in file section,i have declared as
FILE-CONTROL.
SELECT INPUT-FILE ASSIGN TO INPUT1.
SELECT TEMPFILE ASSIGN TO SORTDK.
SELECT OUTPUT-FILE ASSIGN TO OUTPUT1.

for tempfile,i have declared a SD description in data division.
but in my jcl,even if i am not specifying any ddname with SORTDK,it works.according to my understanding,this shouldn't happen unless we specify OPTIONAL clause.
Pls clarify...........
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Apr 06, 2007 12:04 am
Reply with quote

Hello,

What you've posted looks incomplete.

Please copy/paste your actual code from the program for the selects, the FD/SDs, and the procedure division for the sort includeing 5 or 10 lines before and after the sort statement.

Even though you may "get away" withou including the DD(s) for the sort file, it is a good practice to include them. It makes the JCL easier to understand. There may also be situations where you must include the DDs, so rather than be concerned as to when, just always include them.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Apr 06, 2007 12:21 am
Reply with quote

chan2004 wrote:
also,in file section,i have declared as
FILE-CONTROL.
SELECT INPUT-FILE ASSIGN TO INPUT1.
SELECT TEMPFILE ASSIGN TO SORTDK.
SELECT OUTPUT-FILE ASSIGN TO OUTPUT1.

for tempfile,i have declared a SD description in data division.
but in my jcl,even if i am not specifying any ddname with SORTDK,it works.according to my understanding,this shouldn't happen unless we specify OPTIONAL clause.
Pls clarify...........
Wish I could, You realize that SORT can do the allocation of work files on the fly, pretty powerful stuff and actually the file defined by the SD really isn't a file, but more like a portal to SORT. Maybe it just doesn't need the DDs anymore.
Quote:
what i noticed was if i don't put any statement before sort stmt,it gives a sort return code of 20.but if i put any statement like stmnt 1,it will work fine
why is it like that?
Now that's a good one, I'd generate two compiles with the assembler translations, one with and one without the extra initial statement, and look at the generated code to see if I could see anything. If you can nail down it as a bug, you might get the APAR named after in your honor.... icon_wink.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Apr 06, 2007 12:54 am
Reply with quote

Hi Bill,

Yup, the newer versions of both DFSORT and Syncsort will dynamically allocate sortwk dasd.

My preference is to code them in the JCL to make it obvious there is a sort here as well as showing large allocations in the case of "big" sorts. Sometimes the dynamic allocations abend (x37), but if properly specified, more is available.
Back to top
View user's profile Send private message
chan2004

New User


Joined: 28 Mar 2007
Posts: 16
Location: India

PostPosted: Tue Apr 10, 2007 12:20 pm
Reply with quote

Hi

so,dfsort dynamically allocates all the files.
if so,is it necessary to specify tempfile in FILECONTROL
i am getting an abend if i doesn't do it.

also,one more thing i noticed was in the jcl,if i code a dd name CHAN1 with a temporary dataset allocation,it works.i consider that as strange because in my program i am not declaring anything like CHAN1.pls clarify this also

for the second thing,is it really a bug???

also,how to know the version of dfsort that i use

chan
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Apr 10, 2007 7:17 pm
Reply with quote

chan2004 wrote:
also,one more thing i noticed was in the jcl,if i code a dd name CHAN1 with a temporary dataset allocation,it works.i consider that as strange because in my program i am not declaring anything like CHAN1.pls clarify this also
sort of like IEFBR14
Quote:
also,how to know the version of dfsort that i use
There should be some sysout/print/? in the output that has all that information. Check your sort manual for the proper DD name.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Apr 10, 2007 7:34 pm
Reply with quote

Hello,

Even though sort can dynamically allocate the sortwork dasd, you must specify the SELECT and the SD. The dynamic allocation has nothing to do with the COBOL requirement in the SELECT/SD.

You need to post more if you have something going on with "chan1". We can only guess as to what you've done. For this type of question, it is a good idea to post all of the jcl for the step as well as all of the select/assigns. The SD might also help.
Back to top
View user's profile Send private message
chan2004

New User


Joined: 28 Mar 2007
Posts: 16
Location: India

PostPosted: Wed Apr 11, 2007 9:07 am
Reply with quote

jcl is like this

//test123 JOB MSGCLASS=X,MSGLEVEL=(1,1),CLASS=B,
// REGION=5M,NOTIFY=&SYSUID
//step1 exec pgm=test1
//input1 dd dsn=u123456.test.input,disp=shr
//output1 dd dsn=u123456.test.input,disp=shr
//chan1 dd dsn=&&temp,disp=........................
//sysprint dd sysout=*
//sysout dd sysout=*

i didn't understand how IEFBR14 handles the chan1

also,i checked in the dfsort and found the version
thanks for helping
--- william & dick
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Apr 11, 2007 6:49 pm
Reply with quote

Hello,

IEFBR14 does not "handle" chan1 (or anythng else). IEFBR14 is a "place holder" step that allows step-level allocation and de-allocation of the dd statements in that step (their DISP will be processed). It is a way to do housekeeping in a job.

I see no IEFBR14 in the posted jcl or earlier text. How does IEFBR14 relate to the sort/sd question?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Apr 11, 2007 6:57 pm
Reply with quote

chan2004 wrote:
also,one more thing i noticed was in the jcl,if i code a dd name CHAN1 with a temporary dataset allocation,it works.i consider that as strange because in my program i am not declaring anything like CHAN1.pls clarify this also
sort of like IEFBR14 does.......
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Wed Apr 11, 2007 6:58 pm
Reply with quote

The only time I've had a RC20 from calling SORT was from a REXX program.

Do you have the following DD names allocated to your JCl, because that was my problem in the REXX, I had forgotten to put them into the JCL.

//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Apr 11, 2007 7:19 pm
Reply with quote

Hello,

Are you using DFsort or Syncort?

If you post all of the jes&jcl output we can better help.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts run rexx code with jcl CLIST & REXX 15
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top