View previous topic :: View next topic
|
Author |
Message |
chan2004
New User
Joined: 28 Mar 2007 Posts: 16 Location: India
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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.... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
chan2004
New User
Joined: 28 Mar 2007 Posts: 16 Location: India
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
chan2004
New User
Joined: 28 Mar 2007 Posts: 16 Location: India
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Are you using DFsort or Syncort?
If you post all of the jes&jcl output we can better help. |
|
Back to top |
|
|
|