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

Sorting Out Comp-3 fields


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
andreateh

New User


Joined: 31 Aug 2005
Posts: 3
Location: Malaysia

PostPosted: Tue Nov 15, 2005 4:45 pm
Reply with quote

Hi!

I'm trying to separate out records in a file into two data sets based on the values in a PIC S9(9)V99 COMP-3 field starting in position 107. In the first data set, I want records with values in the field that are greater than or equal to 250. In the second data set, I want records with values in the field that are less than 250. However it seems that everything in my input file goes into the first file (OUT1) without being sorted and second file remains empty.
I've referred to
http://www-03.ibm.com/servers/storage/support/software/sort/mvs/professor_sort/srtmacfm.html
Is there anything wrong with my JCL coding? Any solution?
Thanks!

Here's my input file layout beginning from position 107-112

.....*
000105
00057C
-----
....?*
000145
00002C
-----
......
000200
00000C
-----
... ..
000400
00000C
-----
......
000300
00000C
......
000300
00000C
-----
......
000030
00083C
-----
.....%
000236
00010C
-----
....?.
000183
00030C
-----
....?<
000274
00063C
-----

Here's my JCL:

//ESISORT EXEC SORT,PARM='SIZE=MAX'
//SORTIN DD DSN=SMN041.TESTS.CMTPCHRG.ESI.SORT,DISP=SHR
//OUT1 DD DSN=SMN041.TESTS.SORTED.ESI1,
// DISP=(NEW,CATLG,DELETE),UNIT=DISK,
// SPACE=(CYL,(1,1),RLSE),
// DCB=(RECFM=FB,LRECL=650,BUFNO=10)
//OUT2 DD DSN=SMN041.TESTS.SORTED.ESI2,
// DISP=(NEW,CATLG,DELETE),UNIT=DISK,
// SPACE=(CYL,(1,1),RLSE),
// DCB=(RECFM=FB,LRECL=650,BUFNO=10)
//SORTWK01 DD UNIT=DISK,SPACE=(CYL,(1,1))
//SORTWK02 DD UNIT=DISK,SPACE=(CYL,(1,1))
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=OUT1,
INCLUDE=(107,6,PD,GE,+250)
OUTFIL FNAMES=OUT2,
INCLUDE=(107,6,PD,LT,+250)
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Nov 15, 2005 10:21 pm
Reply with quote

PIC S9(9)V99 COMP-3 represents a 6-byte PD value with an implied decimal point before the last two digits. So, for example, your input value of X'00010500057C' is actually 000000104.25. Your constant of +250 is actually interpreted as +2.50. You should be using a constant of +25000 which will be interpreted as +250.00. So your OUTFIL statements should be:

Code:

   OUTFIL FNAMES=OUT1,           
     INCLUDE=(107,6,PD,GE,+25000)
   OUTFIL FNAMES=OUT2,           
     INCLUDE=(107,6,PD,LT,+25000)


Note that you could replace the second OUTFIL statement with:

Code:

    OUTFIL FNAMES=OUT2,SAVE
Back to top
View user's profile Send private message
andreateh

New User


Joined: 31 Aug 2005
Posts: 3
Location: Malaysia

PostPosted: Wed Nov 16, 2005 6:42 am
Reply with quote

Hi Frank!

Thanks for your prompt reply. Your first recommendation worked perfectly.

You also recommended that I can replace the second OUTFIL statement as

OUTFIL FNAMES=OUT2,SAVE

However I received the msg below when trying:

1 - CONTROL STATEMENTS FOR 5740-SM1, DFSORT REL 14.0
OPTION COPY
OUTFIL FNAMES=OUT1,
INCLUDE=(107,6,PD,GE,+25000)
OUTFIL FNAMES=OUT2,SAVE
0 RECORD TYPE IS F - DATA STARTS IN POSITION 1
0 NO LENGTH OPERAND
0 SORTIN NOT DEFINED
3 END OF DFSORT

What does SAVE imply?

Thanks!
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Nov 16, 2005 6:56 am
Reply with quote

SAVE is just a way to say give me the records for this OUTFIL that were not included by any other OUTFIL. The messages you show have nothing to do with SAVE. They indicate that you didn't have a //SORTIN DD statement for that run. Take a look at your JCL to confirm.
Back to top
View user's profile Send private message
andreateh

New User


Joined: 31 Aug 2005
Posts: 3
Location: Malaysia

PostPosted: Wed Nov 16, 2005 7:08 am
Reply with quote

Hi Frank!

Yes, you are right. Thanks for correcting me.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
This topic is locked: you cannot edit posts or make replies. Automation need help in sorting the data DFSORT/ICETOOL 38
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
Search our Forums:

Back to Top