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

Splitting the file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Thu Mar 04, 2010 12:19 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Mar 04, 2010 12:28 pm
Reply with quote

Why are there differences in the length being compared between the two OUTFIL statements.
Back to top
View user's profile Send private message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Thu Mar 04, 2010 12:35 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Mar 04, 2010 12:51 pm
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Mar 04, 2010 1:00 pm
Reply with quote

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
View user's profile Send private message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Thu Mar 04, 2010 1:06 pm
Reply with quote

Its working!!!!
Thanks a lot !!!
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Mar 04, 2010 1:09 pm
Reply with quote

Debasis Misra wrote:
Its working!!!!
Thanks a lot !!!

I am Glad. icon_smile.gif
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Mar 04, 2010 1:33 pm
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Mar 04, 2010 2:59 pm
Reply with quote

Yes CICS Guy,
You are right, if negative values are present then SFF should be used.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Mar 04, 2010 8:53 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Mar 04, 2010 11:23 pm
Reply with quote

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
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
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top