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

SYNCSORT - File Formatting Help


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
meteorite

New User


Joined: 31 May 2006
Posts: 2

PostPosted: Mon Jun 16, 2008 1:21 pm
Reply with quote

Hi,

I have the following Input File:

Field1 Field2 Field3
AAAA bbbbb 11111
BBBB 33333
DDDD 33235
CCCC bbbbb 23433

<Note: "bbbbb" stands for blanks/spaces.>

I need to reformat it as shown below:

Field1 Field2
AAAA +11111
BBBB -33333
DDDD -33235
CCCC +23433

i.e., the difference in the output is that the values in Field3 of Input File should be preceded with a + sign and those in Field2 should be preceded with a - sign and all of these values should appear in Field2's position in the output file. And, do note that the input file has no fixed pattern in the order of records, i.e., each record can have a value in either the Field2 or the Field3, but only in one of them.

Do let me know if the above can be solved using SYNCSORT?
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Mon Jun 16, 2008 4:06 pm
Reply with quote

This should work. Please try and confirm.

Code:

 OPTION COPY                                 
 INREC IFTHEN=(WHEN=(6,5,CH,LT,12,5,CH),     
        BUILD=(1,5,C'+',12,5)),               
        IFTHEN=(WHEN=(6,5,CH,GT,12,5,CH),     
        BUILD=(1,5,C'-',6,5))                 
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: Mon Jun 16, 2008 8:19 pm
Reply with quote

Hello,

Quote:
This should work. Please try and confirm.
Did you try the code?

The code compares 2 fields in a record and generates a +/- based on the output of the compare. I see nothing like that in the initial request. . .
Back to top
View user's profile Send private message
Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Mon Jun 16, 2008 9:01 pm
Reply with quote

Hi Dick,

I should have mentioned this earlier. Sorry.

I assumed that for records where field2 and field3 are present field2 is always alphabetic and field3 is numeric. Similarly for the other record assumed field2 is numeric and field3 is alphabetic/spaces. I have tested with the given data and it works.

For ex. for the first record AAAA bbbbb 11111

BBBBB is less than 111111 hence AAAA +11111 is written to the output

For second record BBBB 33333

333333 is greater than spaces hence BBBB -333333 is written to the output.
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: Mon Jun 16, 2008 10:12 pm
Reply with quote

Hello Manu,

Thanks for the clarification.

My simple brain was thinking of just checking for non-blank icon_smile.gif

d
Back to top
View user's profile Send private message
meteorite

New User


Joined: 31 May 2006
Posts: 2

PostPosted: Tue Jun 17, 2008 2:00 am
Reply with quote

Manu,

Thanks a lot! Your solution worked like a charm icon_biggrin.gif

Regards,
m
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 -> JCL & VSAM

 


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