View previous topic :: View next topic
|
Author |
Message |
Debasis Misra Warnings : 1 New User
Joined: 16 Sep 2008 Posts: 72 Location: Bangalore
|
|
|
|
The I/P file contains the records in the following format :
Code: |
A1234A1
B0000B1
C 12C1
D D1
E0000E1
F0 F1 |
We have to split the file based on the cols 2 to 5 (Starting Position =2, Length =4).
If Cols 2 to 5 is > 0, then write in the 1st file
If Cols 2 to 5 is =< 0, then write in the 2nd file.
I have run the SORT step by using the following sort card :
SORT FIELDS=COPY
OUTFIL FILES=1,INCLUDE=(2,4,CH,GT,C'0000')
OUTFIL FILES=2,INCLUDE=(2,9,CH,LE,C'0000').
Now the 3rd record (Starting from 'C' ) is greater than 0, but still its coming in the 2nd file.
Can anyone please suggest me how to solve this problem? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Why are there differences in the length being compared between the two OUTFIL statements. |
|
Back to top |
|
|
Debasis Misra Warnings : 1 New User
Joined: 16 Sep 2008 Posts: 72 Location: Bangalore
|
|
|
|
Really Sorry!
Modifying the sort card :
SORT FIELDS=COPY
OUTFIL FILES=1,INCLUDE=(2,4,CH,GT,C'0000')
OUTFIL FILES=2,INCLUDE=(2,4,CH,LE,C'0000').
Giving same problem still. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Looking at the hex / binary representations
C'0' is 'F0'X is '11110000'B
space is '40'X is '01000000'B
During your comparison the full four bytes of the control will be
'11110000111100001111000011110000' but the first byte as a space will give
'01000000........................' which is less than the control of C'0000'.
Maybe ALTSEQ will help you to convert the space to zero. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Below sortcard will give you desired output..
Code: |
//S1 EXEC PGM=SORT
//SORTIN DD *
A1234A1
B0000B1
C 12C1
D D1
E0000E1
F F1
//SORTOF01 DD SYSOUT=*
//SORTOF02 DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=SORTOF01,INCLUDE=(2,4,UFF,GT,0)
OUTFIL FNAMES=SORTOF02,SAVE
/*
|
|
|
Back to top |
|
|
Debasis Misra Warnings : 1 New User
Joined: 16 Sep 2008 Posts: 72 Location: Bangalore
|
|
|
|
Its working!!!!
Thanks a lot !!! |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Debasis Misra wrote: |
Its working!!!!
Thanks a lot !!! |
I am Glad. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Debasis Misra wrote: |
If Cols 2 to 5 is > 0, then write in the 1st file
If Cols 2 to 5 is =< 0, then write in the 2nd file. |
Why are you comparing an alphanumeric field with what is basicly a numeric oprand?
The leading blanks will always be lower than any numeric or alphabetic characters.
Sambhaji wrote: |
Below sortcard will give you desired output..
[code] OUTFIL FNAMES=SORTOF01,INCLUDE=(2,4,UFF,GT,0) |
Since the field specified is not numeric, what will DFSort do with it if there were no numerics and one or more alpha characters in it?
Since USS ignores any sign representation, maybe SFF might be better (assuming that field can ever be negative and less than C'0000'..... |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Yes CICS Guy,
You are right, if negative values are present then SFF should be used. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
OK for the values that are "numeric" but what about:
Quote: |
Since the field specified is not numeric, what will DFSort do with it if there were no numerics and one or more alpha characters in it? |
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
Since the field specified is not numeric, what will DFSort do with it if there were no numerics and one or more alpha characters in it? |
With UFF or SFF format, DFSORT would treat the value as 0 in this case. |
|
Back to top |
|
|
|