Sort VB file and prefix the records



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

Sort VB file and prefix the records

Postby Girish12 » Wed Aug 02, 2017 5:59 pm

Input file of VB and sample structure of input file is as below:


A1110201CITY46000         ---->Header record with length 20 bytes. Record type A (Header).
B41164MMNY735XNJ3562790   ---->record with length length 27 bytes. Record type B (Detail).
B23284LMKY516YNJ4462800   ---->record with length length 27 bytes. Record type B (Detail).
B36374PMJY398RNJ6213567   ---->record with length length 27 bytes. Record type B (Detail).
B37374EQJY318INJ6213567   ---->record with length length 27 bytes. Record type B (Detail).
Z9991301TOTA99999         ---->Header record with length 20 bytes. Record type Z (Trailer).
A1110301CITY46000         ---->Header record with length 20 bytes. Record type A (Header).  
B42454TMNY735XNJ3562790   ---->record with length length 27 bytes. Record type B (Detail).
B26266SMKY516YNJ4462800   ---->record with length length 27 bytes. Record type B (Detail).
Z9991301TOTA99999         ---->Header record with length 20 bytes. Record type Z (Trailer).
 

This is one physical file containing several logical files.
First postion indicates the record type.

Query:
I want to prefix 020 for A record type in the position 1-3
and prefix 026 for B record type in the position 1-3
and prefix 020 for Z record type in the position 1-3.

And want to copy the data to another VB file which has A record of 20bytes, B record of 26 bytes and Z of 20 bytes.

We can do this using cobol code, but I would like to know if its possible with any JCL utility or any other tool.

Thanks,
Giri

Coded for you
Girish12
 
Posts: 4
Joined: Wed Aug 02, 2017 4:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sort VB file and prefix the records

Postby steve-myers » Wed Aug 02, 2017 6:53 pm

We go through this with almost every new user. Please do not think we want to discourage new users from making reasonable requests. But we need to really understand what you think you need.
  1. Please put your request in the appropriate section of the forum. Well, I think you did this, so that's not a problem here! You would be amazed how often this isn't done!
  2. If your native language is not English, please try to use the best English you can.
  3. Do not use SMS crp. Use a real keyboard, if possible, or at least pretend you're using a real keyboard!
  4. When you post data in a fixed width font, please use code tags.
    THIS CAME FROM MY MAINFRAME

    as opposed to

    THIS CAME FROM MY MAINFRAME

    You can insert code tags by clicking the little code button above the entry screen. Those of us that have been doing this for a while tend to write the code tags manually, but that's too much to ask of a new user. It's also nice to insert an ISPF style ruler with your text.
    ----+----1----+----2----+----3
    THIS CAME FROM MY MAINFRAME
    Sometimes it helps to build your text in something like Windoze notepad and copying the completed text to the entry screen.
  5. If you want to alter the data in some way, please provide an example.
    XXXTHIS CAME FROM MY MAINFRAME
  6. Please review what you are posting by clicking on the Preview button at the bottom of the entry screen. After it looks right, then click the Submit button.
By the way, this forum uses phBB software. You can find out more about phBB text markup through Google.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Sort VB file and prefix the records

Postby Girish12 » Wed Aug 02, 2017 7:27 pm

Thanks Steve for the details.
Would follow the guidelines in future :)
Girish12
 
Posts: 4
Joined: Wed Aug 02, 2017 4:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sort VB file and prefix the records

Postby Girish12 » Thu Aug 10, 2017 3:08 pm

Hi Steve and other members,

Could you please give some hint on the query.

Thanks,
Girish
Girish12
 
Posts: 4
Joined: Wed Aug 02, 2017 4:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sort VB file and prefix the records

Postby Robert Sample » Thu Aug 10, 2017 4:54 pm

What have you tried so far? How are the results you've received different from what you expected? If you haven't tried anything yet, look at the SORT IF statement for an idea on how to start, then post again after you've tried it.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Sort VB file and prefix the records

Postby Girish12 » Thu Aug 10, 2017 5:00 pm

Thanks Robert for the suggestion.
Let me try with SORT IF and comeback with the results.

Regards,
Girish
Girish12
 
Posts: 4
Joined: Wed Aug 02, 2017 4:50 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sort VB file and prefix the records

Postby Aki88 » Mon Aug 21, 2017 9:59 pm

Hello,

Can you please show the expected output?

Edit: Aside, this can be achieved by using an INREC/IFTHEN=WHEN, coupled with a BUILD statement, should you choose *SORT as a probable solution. Test header, tail record or detail record using aforementioned keywords, thus BUILDing your needed record. If you don't want the data to be reordered, then use 'SORT FIELDS=COPY'.
The point here being, how do you want the existing data in the first three bytes to be represented post overlaying it with the numbers you've shown.
Also, while you're working with this data, please do ensure to add 4 bytes for RDW in your SORT card to ensure correct field position mapping.
Aki88
 
Posts: 381
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post