Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

SYNCSORT - File Formatting Help

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: SYNCSORT - File Formatting Help
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    Post subject:
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

Site Director


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

PostPosted: Mon Jun 16, 2008 8:19 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Mon Jun 16, 2008 10:12 pm    Post subject: Reply to: SYNCSORT - File Formatting Help
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 5 Sat Jan 21, 2017 4:02 am
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us