View previous topic :: View next topic
Author
Message
avinash sengar New User Joined: 13 May 2010Posts: 16 Location: hyderabad
Hi ,
I want to do a sort an I/P file on first 12 bytes ,
when i am giving the SORT FIELDS=(1,12,CH,A) ,
the ouput is coming in descending order instead of ascending.
and when i am giving the SORT FIELDS=(1,12,CH,D) ,
the output is coming in Ascending order.
i am not able to find the cause of this reverse action.
Please help.
Below is the data of I/P file and sorted output file
INP file
11A019744400
11A023666500
11A025620401
11A035790200
SORT CARD
//SYSIN DD *
SORT FIELDS=(1,12,CH,A)
/*
//*
sorted file output
11A035790200
11A025620401
11A023666500
11A019744400
Thanks
Back to top
Akatsukami Global Moderator Joined: 03 Oct 2009Posts: 1788 Location: Bloomington, IL
Use Code tags.
What is the record format (RECFM) of your input data set?
Back to top
avinash sengar New User Joined: 13 May 2010Posts: 16 Location: hyderabad
RECFM is VB
Below is the code i ran
Code:
//JS080 EXEC PGM=SORT
//SYSOUT DD SYSOUT=(,)
//SORTIN DD DSN=T4053.DA.I259BA.CSPCMS.HOSP837.CLAIM,DISP=SHR
//SORTOUT DD DSN=T4053.DA.I259BA.CSPCMS.HOSP837.CLMSORT,
// DISP=(NEW,CATLG,DELETE),UNIT=DISK,
// DCB=(RECFM=VB,LRECL=2382,BLKSIZE=0),
// MGMTCLAS=AMLYBW,SPACE=(TRK,(0500,500),RLSE)
//SORTWK01 DD UNIT=DISK,SPACE=(CYL,(100,50),RLSE)
//SORTWK02 DD UNIT=DISK,SPACE=(CYL,(100,50),RLSE)
//SYSIN DD *
SORT FIELDS=(1,12,CH,A)
/*
//*
Thanks!!
Edited to add code tags.
Back to top
Anuj Dhawan Superior Member Joined: 22 Apr 2006Posts: 6250 Location: Mumbai, India
As Akatsukami has correctly guessed, Try:
Code:
//SYSIN DD *
SORT FIELDS=(5,12,CH,A)
/*
However, per the data you show, is the file a "real VB"?
Back to top
Akatsukami Global Moderator Joined: 03 Oct 2009Posts: 1788 Location: Bloomington, IL
avinash sengar wrote:
RECFM is VB
Below is the code i ran
//JS080 EXEC PGM=SORT
//SYSOUT DD SYSOUT=(,)
//SORTIN DD DSN=T4053.DA.I259BA.CSPCMS.HOSP837.CLAIM,DISP=SHR
//SORTOUT DD DSN=T4053.DA.I259BA.CSPCMS.HOSP837.CLMSORT,
// DISP=(NEW,CATLG,DELETE),UNIT=DISK,
// DCB=(RECFM=VB,LRECL=2382,BLKSIZE=0),
// MGMTCLAS=AMLYBW,SPACE=(TRK,(0500,500),RLSE)
//SORTWK01 DD UNIT=DISK,SPACE=(CYL,(100,50),RLSE)
//SORTWK02 DD UNIT=DISK,SPACE=(CYL,(100,50),RLSE)
//SYSIN DD *
SORT FIELDS=(1,12,CH,A)
/*
//*
Thanks!!
So you didn't realize that your sort product would sort the record descriptor word (RDW) before your intended key? Begin by changing your sort card to be
Code:
SORT FIELDS=(5,12,CH,A)
If you still have problems, post the messages from the SYSOUT DD in Code tags .
Back to top
Please enable JavaScript!