View previous topic :: View next topic
|
Author |
Message |
sarathbabum Currently Banned New User
Joined: 15 Mar 2007 Posts: 12 Location: Kerala
|
|
|
|
hi ,
i have done a simple sort pgm in cobol using jcl, using temproary files. but the s/m creating the sorted file with output. the code is below
Code: |
//FILE JOB NOTIFY=ESCUB11,MSGLEVEL=(1,0)
//JOBLIB DD DSN=ESCUB11.SARATH.LOAD,DISP=SHR
//S1 EXEC PGM=SORTCOB
//MADE DD DSN=ESCUB11.SARATH.FILE11,
// DISP=SHR
//MADE1 DD DSN=&&TEMP
//MADE2 DD DSN=ESCUB11.SARATH.FILE17,
// DISP=(NEW,CATLG,DELETE),
// VOL=SER=USER04,
// UNIT=SYSDA,
// SPACE=(TRK,(1,3),RLSE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PS)
// |
|
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi There,
Would u please paste ur program code?
And please specify what do u mean by this?
Quote: |
but the s/m creating the sorted file with output |
|
|
Back to top |
|
|
sarathbabum Currently Banned New User
Joined: 15 Mar 2007 Posts: 12 Location: Kerala
|
|
|
|
in the above pgm dd name made refer to the file where the records are stored. dd name made 2 for creating a o/p file for the sorted data. my pgm not working even though i got maxcc =0.
IGZ0026W The SORT-RETURN special register was never referenced
this was the msg i got when i execute the pgm. |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi Sarath,
As i said u previously would you please paste the code from program where r u using sorting? |
|
Back to top |
|
|
sarathbabum Currently Banned New User
Joined: 15 Mar 2007 Posts: 12 Location: Kerala
|
|
|
|
Code: |
IDENTIFICATION DIVISION.
PROGRAM-ID. XYZ.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INFILE ASSIGN TO MADE
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS FS1.
SELECT WORKFILE ASSIGN TO MADE1.
SELECT OUTFILE ASSIGN TO MADE2
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS FS2.
DATA DIVISION.
FILE SECTION.
FD INFILE
LABEL RECORDS ARE STANDARD
RECORDING MODE IS F
DATA RECORD IS EMPREC.
01 EMPREC.
02 NAME PIC X(10).
02 AGE PIC 9(2).
02 DEP PIC X(2).
02 FILLER PIC X(66).
SD WORKFILE.
01 WORKREC.
02 WNAME PIC X(10).
02 FILLER PIC X(70).
FD OUTFILE
LABEL RECORDS ARE STANDARD
RECORDING MODE IS F
DATA RECORD IS OUTREC.
01 OUTREC.
02 ONAME PIC X(10).
02 OAGE PIC 9(2).
02 ODEP PIC X(2).
02 FILLER PIC X(66).
WORKING-STORAGE SECTION.
01 FS1 PIC X(2).
01 FS2 PIC X(2).
PROCEDURE DIVISION.
P1.
SORT WORKFILE ON ASCENDING KEY WNAME
USING INFILE
GIVING OUTFILE.
STOP RUN. |
[/quote] |
|
Back to top |
|
|
sarathbabum Currently Banned New User
Joined: 15 Mar 2007 Posts: 12 Location: Kerala
|
|
|
|
hi,
i want to sort a simple sequential file using simple sort...
please help me |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Is there any reason why you would want to write a program rather than use the SORT product available at your site ? |
|
Back to top |
|
|
sarathbabum Currently Banned New User
Joined: 15 Mar 2007 Posts: 12 Location: Kerala
|
|
|
|
sorry i didnt get any out put. but a file is created with out any data[/quote] |
|
Back to top |
|
|
sarathbabum Currently Banned New User
Joined: 15 Mar 2007 Posts: 12 Location: Kerala
|
|
|
|
because i am in my startting level, i don't know to use utilities. so please tell why i dont get the sorted file. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
OK, I am not a programmer so may well be very wrong here.
You say that DDNAME MADE is where your reords are, but are you not sorting WORKFILE which I think relates to DDNAME MADE1 which is allocated to DSN=&&TEMP
If this is the case, are there any records in &&TEMP
As for utilities, take some time and look at them, DFSORT is a very good friend to have. |
|
Back to top |
|
|
sarathbabum Currently Banned New User
Joined: 15 Mar 2007 Posts: 12 Location: Kerala
|
|
|
|
the file that i refer using DD name MADE contains the data records that i want to sort... |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
But your sort refers to WORKFILE which relates to DDNAME MADE1, but your records for sorting are in DDNAME MADE.
Quote: |
SORT WORKFILE ON ASCENDING KEY WNAME
USING INFILE
GIVING OUTFILE.
STOP RUN.
|
|
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Expat, it is correct, you sort the SD (workfile) using input giving output. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Yes, but it seems to me that you have not put any records into WORKFILE, so there is nothing to sort, so no output.
As I said, I am not a programmer, merely offering a suggestion or two. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Sarath,
There should be some additional output in the jes queue, SYSOUT or SYSPRINT or similat with some additional information about the sort.
Just to confirm that you are executing the program you think you are, after the paragraph header "P1" and befroe the SORT verb, put a DISPLAY 'This is the correct program'. Then recompile and re-execute it. Let us know how everything went. |
|
Back to top |
|
|
ibm4me
New User
Joined: 23 Oct 2006 Posts: 3
|
|
|
|
// JOB card
// JCLLIB ORDER = YOUR.PDS
//STEP1 EXEC PGM = IGYSORT, MEM = YOURMEMBER
//COBOL.SYSIN DD DSN = YOUR.PDS(&MEM), DISP = SHR
//GO.DD1 DD DSN = INPUT FILE, DISP = SHR
//GO.DD2 DD DSN = &&TEMP, DISP = NEW
//* "OUTFILE" IF IT IS ALREADY CREATED
//GO.DD3 DD DSN = OUTPUTFILE, DISP = SHR
//GO.SYSIN DD *
/*
// |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Have you verified that this:
Quote: |
the file that i refer using DD name MADE contains the data records that i want to sort |
is true?
Please go into tso and browse the dataset and make sure there records in the file.
To clear up a bit of confusion on the internal sort - the sort statement refers to the "sort work file" (in many cases "SELECT SORT-FILE ASSIGN TO UT-S-SORTWK01" is used and the sortwork DD statement(s) are the same as if an external sort was used). When using/giving is specified, the "sort" record is not referenced in the code. With "using", the "input" fd specified is read and processed by the sort (in the file defined as an SD (rather than FD)). When "giving" is specified, the final output from the sort is written to the output fd.
For an educational exercise using/giving will run, but when working on programs that will be promoted to production using/giving should not be used in the same program. It is the worst possible performance choice. |
|
Back to top |
|
|
|