Syncsort - Copy and Reformat



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Syncsort - Copy and Reformat

Postby ranga_subham » Mon Sep 10, 2012 5:28 pm

Hi, we get a flat file (LRECL=80,RECFM=FB) and need to reformat it to populate a key field on each record.

Input:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
SRT3     STATUSFL1303404GH6                              #T#           1   
31055ABC0121X6AL5S3 D0      3012052512X226111290N   6AB6922521420        3A
33111XYZ1231Y6AH5S3 D1      3012070312Y2282     N   6AB6922521420        3A
MUT4     STATUSFL1400048MK3                              #T#           1   
74620DEF2134G1J86CC E1      3012090572Z313372650N   1JC4822521243        4J
74620ZEB3218G1J86CC E2      3012090572O313372650N   1JD4822521243        4J


Rules:
The header record should copy content from 10th column (15 bytes) and put it before value appearing in 1st column and newly formed value should begin at 13th column and 37th column.
The detail record should add a key field from -
'D' or 'E' appearing at 21st column should be converted to '13' or '14' respectively and copied to 1st column
A Value appearing at 37th column should be copied to 3rd column and 11th column
6 characters starting at 6th column should be copied to 5th column
The 10 characters (STATUSFL13 or STATUSFL14 from respective headers) appearing in header record should be copied to 13th column
The 6 digit value appearing at 23rd column should be copied to 23rd column from respective header record


Output:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
            STATUSFL1303404SRT5     STATUSFL1303404GH6                         
1312ABC01212STATUSFL130340431055ABC0121X6AL5S3 D0      3012052512X226111290N   6
1312XYZ12312STATUSFL130340433111XYZ1231Y6AH5S3 D1      3012070312Y2282     N   6
            STATUSFL1400048MUT4     STATUSFL1400048MK3                         
1472DEF21372STATUSFL140004874620DEF2134G1J86CC E1      3012090572Z313372650N   1
1472ZEB32172STATUSFL140004874620ZEB3218G1J86CC E2      3012090572O313372650N   1


Please help me to achieve this.

Thanks.
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Syncsort - Copy and Reformat

 

Re: Syncsort - Copy and Reformat

Postby dick scherrer » Mon Sep 10, 2012 7:40 pm

Hello,

You need to post what you have done so far and where there is a problem.

Our intent is to help you learn, not do the work for you.

There are similar topics you can find and use here in the forum to get almost all of this working (maybe even all of it).
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Syncsort - Copy and Reformat

Postby BillyBoyo » Mon Sep 10, 2012 10:22 pm

How do you identify the "header" record. Look at WHEN=GROUP with BEGIN and PUSH for the information you want to copy to other records.

Other than that, you have some reformatting (header and detail records) with BUILD.

If you are new to this, start with one thing, like reformatting the header, and go on from there.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Syncsort - Copy and Reformat

Postby ranga_subham » Tue Sep 11, 2012 6:20 pm

I tried it like this

1). Use WHEN=GROUP on unique identifier and push header data to 90th column and populate it on to detail records
2). Use unique identifier from header and populate header data as required
3). Use WHEN=NONE and reformat detail records as required


But, I am unable to convert 'D' to 13 or 'E' to 14.

Thanks.
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Syncsort - Copy and Reformat

Postby ranga_subham » Tue Sep 11, 2012 7:01 pm

This is what I could all write to get the results but incomplete :cry:
I am not able to get the 'D' or 'E' from 21st position converted to '13' and '14' respectively.

//SYSIN    DD *                                               
  SORT FIELDS=COPY                                             
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(58,3,CH,EQ,C'#T#'),         
                 PUSH=(75:1,72)),                             
         IFTHEN=(WHEN=(58,3,CH,EQ,C'#T#'),                     
                 BUILD=(13:84,15,75,4,37:10,62)),             
         IFTHEN=(WHEN=NONE,BUILD=(1:92,2,3:37,2,5:6,6,11:37,2,
                                  13:84,15,28:1,72))           


Any help is greatly appreciated. Thanks.
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Syncsort - Copy and Reformat

Postby dick scherrer » Tue Sep 11, 2012 7:20 pm

Hello,

It will probably help if you post the informational messages generated by the run.

Was the return code = zero?

Posting a bit of the input data and the generated output data will also help. Do use the Code tag to preserve alignment.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Syncsort - Copy and Reformat

Postby ranga_subham » Tue Sep 11, 2012 8:01 pm

Job ran with ZERO return code.......posted both input and output in the first post itself :o
ranga_subham
 
Posts: 279
Joined: Fri Jul 18, 2008 7:46 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Syncsort - Copy and Reformat

Postby Akatsukami » Tue Sep 11, 2012 8:34 pm

ranga_subham wrote:Job ran with ZERO return code.......posted both input and output in the first post itself :o

dick scherrer wrote:It will probably help if you post the informational messages generated by the run.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Syncsort - Copy and Reformat

Postby dick scherrer » Tue Sep 11, 2012 9:16 pm

Hello,

posted both input and output in the first post itself
Yup, but i was not sure if this was the output you got from the run or what you wanted. We probably need to see both (preferably all 3 - input, actual op, wanted op) in the same post to make it easier to work with.

And, yes - we still need the informational messages generated.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Syncsort - Copy and Reformat

Postby BillyBoyo » Wed Sep 12, 2012 5:10 am

Consult you documentation and see if you have CHANGE available.

If not, you'll have IFTHEN=(WHEN= for value),OVERLAY=(1:nn).
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Next

Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post