Page 1 of 1

Sort VB file and prefix the records

PostPosted: Wed Aug 02, 2017 5:59 pm
by Girish12
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

Re: Sort VB file and prefix the records

PostPosted: Wed Aug 02, 2017 6:53 pm
by steve-myers
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.

Re: Sort VB file and prefix the records

PostPosted: Wed Aug 02, 2017 7:27 pm
by Girish12
Thanks Steve for the details.
Would follow the guidelines in future :)

Re: Sort VB file and prefix the records

PostPosted: Thu Aug 10, 2017 3:08 pm
by Girish12
Hi Steve and other members,

Could you please give some hint on the query.

Thanks,
Girish

Re: Sort VB file and prefix the records

PostPosted: Thu Aug 10, 2017 4:54 pm
by Robert Sample
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.

Re: Sort VB file and prefix the records

PostPosted: Thu Aug 10, 2017 5:00 pm
by Girish12
Thanks Robert for the suggestion.
Let me try with SORT IF and comeback with the results.

Regards,
Girish

Re: Sort VB file and prefix the records

PostPosted: Mon Aug 21, 2017 9:59 pm
by Aki88
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.