Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message

New User

Joined: 05 Mar 2009
Posts: 20
Location: Pune

 Posted: Wed Feb 11, 2015 9:18 pm    Post subject: Replace Data before a delimiter in VB file using SORT Hi, I have a VB file attached as below. I want to replace all 'A', 'B' s with spaces. The max length of A could be 32 and B could be 64. I thought of using PARSE in SORT, but not sure of replacing. Would OVERLAY or BUILD do this? Can some one suggest please

Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Wed Feb 11, 2015 10:32 pm    Post subject: Reply to: Replace Data before a delimiter in VB file using S Please don't attach images. Just highlight, copy and paste from your emulator. It is unclear what you want, so please provide expected output for that input as well. I suspect PARSE will be part of the answer.

New User

Joined: 05 Mar 2009
Posts: 20
Location: Pune

Posted: Thu Feb 12, 2015 11:51 am    Post subject: Reply to: Replace Data before a delimiter in VB file using S

Sorry Bill.

My requirement has also changed meantime.

 Code: ****** ***************************** Top of Data ****************************** 000001 |XXX|YYY|ZZZZZZZZZZ|ABCCSGFDKDGFLJLGRLJSDL|TREASQWSDGSDGSFDZCAB|CCCC|    000002 |XXX|YYY|ZZZZZZZZZZ|FSKFSDKKGFA|FDAWAFSGSDFHDHDFHHHHV|CCCC|              000003 |XXX|YYY|ZZZZZZZZZZ|GKHD|CXCGDFHSFSDGHHJD|CCCC|                          000004 |XXX|YYY|ZZZZZZZZZZ|ATRYE|XCGSGHDHJGFJHJGKHKHGKFSDDSSKBN|CCCC|          000005 |XXX|YYY|ZZZZZZZZZZ|CDFBBNIPBCXZA|BHZDXCVJFJKHJBJLBGJJLKLB|CCCC|        000006 |XXX|YYY|ZZZZZZZZZZ|POITYURNCUZAMNAA|XGDFHFGJFKHJHOJLKJJJMNB|CCCC|      000007 |XXX|YYY|ZZZZZZZZZZ|GKSDFKSGFKKEALGRLW|BGZXDFCHGFJFVSDHJJGHKKGHKKJ|CCCC| 000008 |XXX|YYY|ZZZZZZZZZZ|EWEQCVNPIU|RYJXGFHJCVKJGCGKGKGKB|CCCC|              000009 |XXX|YYY|ZZZZZZZZZZ|DSAPOIYRUENCXZ|SADHHJFJVBHCKHGUKGGHKGKGB|CCCC|      ****** **************************** Bottom of Data ****************************

I want to replace the 4th and 5th position delimited data with spaces.

Output:

 Code: ****** ***************************** Top of Data ****************************** 000001 |XXX|YYY|ZZZZZZZZZZ|                      |                    |CCCC|    000002 |XXX|YYY|ZZZZZZZZZZ|           |                     |CCCC|              000003 |XXX|YYY|ZZZZZZZZZZ|    |                |CCCC|                          000004 |XXX|YYY|ZZZZZZZZZZ|     |                              |CCCC|          000005 |XXX|YYY|ZZZZZZZZZZ|             |                        |CCCC|        000006 |XXX|YYY|ZZZZZZZZZZ|                |                       |CCCC|      000007 |XXX|YYY|ZZZZZZZZZZ|                  |                           |CCCC| 000008 |XXX|YYY|ZZZZZZZZZZ|          |                     |CCCC|              000009 |XXX|YYY|ZZZZZZZZZZ|              |                         |CCCC|      ****** **************************** Bottom of Data ****************************

The maximum length of 4th delimited data can be 32 and 5th can be 64.

Code'd
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Thu Feb 12, 2015 1:07 pm    Post subject: Reply to: Replace Data before a delimiter in VB file using S Thanks, that's much better and confirms what you want done. I forgot to mention the Code Tags to preserve spacing, but if you want to see how it is done use Quote on your post and look at the FAQ. Do you definitely want an equal number of spaces to the number of characters originally in that delimited field? Usually for delimited data, leading/trailing spaces outside of "protectors" around a field (like quote-marks) are ignored. With output like you show, it can be done, but it is a lot of code. A chunk each to determine the length of the two fields, probably then about 50 lines for each to put the correct number of spaces in. You'd also need to know if any of the data has blanks in (leading/trailing/embedded). If the normal "empty" field (just ||) would do, it is quite easy, as it looks like all the other fields are fixed-length.

New User

Joined: 05 Mar 2009
Posts: 20
Location: Pune

 Posted: Thu Feb 12, 2015 1:56 pm    Post subject: A single space would be enough instead of number of characters for 4th and 5th delimited data. Thank you.
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

Posted: Thu Feb 12, 2015 3:12 pm    Post subject: Reply to: Replace Data before a delimiter in VB file using S

 Code: INREC IFTHEN=(WHEN=INIT,   [here put some PARSEing, with %s to ignore the first five pipes, then STARTAFT=C'|',FIXLEN=5]         IFTHEN=(WHEN=INIT,                      BUILD=(1,20,C'| | |',%01))

New User

Joined: 05 Mar 2009
Posts: 20
Location: Pune

 Posted: Thu Feb 19, 2015 6:04 pm    Post subject: Thanks Bill, that worked out. I've got similar requirement whose record length is 5000 and a VB file. Would it be possible to put spaces and extract the rest of data from 6th column till end of record. De-quoted
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Thu Feb 19, 2015 6:38 pm    Post subject: Reply to: Replace Data before a delimiter in VB file using S I'm not sure what you mean. Can you give an example? Shortened representative input and expected output.

New User

Joined: 05 Mar 2009
Posts: 20
Location: Pune

 Posted: Thu Feb 19, 2015 7:35 pm    Post subject: Input File Layout: 000001 |XXX|YYY|ZZZZZZZZZZ|ABCCSGFDKDGFLJLGRLJSDL|TREASQWSDGSDGSFDZCAB|CCCC|DDDDDD|EE|FF|G| 000002 |XXX|YYY|ZZZZZZZZZZ|FSKFSDKKGFA|FDAWAFSGSDFHDHDFHHHHV|CCCC|DDDDD|EE|FF|G| 000003 |XXX|YYY|ZZZZZZZZZZ|GKHD|CXCGDFHSFSDGHHJD|CCCC|DDDDDD|EE|FF|G| Expected Output: 000001 |XXX|YYY|ZZZZZZZZZZ| | |CCCC|DDDDDD|EE|FF|G| 000002 |XXX|YYY|ZZZZZZZZZZ| | |CCCC|DDDDDD|EE|FF|G| 000003 |XXX|YYY|ZZZZZZZZZZ| | |CCCC|DDDDDD|EE|FF|G| There is no data after |G| but the length of file is 5000.[/quote][/code]
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Fri Feb 20, 2015 4:23 am    Post subject: Reply to: Replace Data before a delimiter in VB file using S I don't understand. If there is uno data after the sixth column, then there is no data. You can't have it. You could extend each record to the maximum of the LRECL, but why would you want to do that? Which version of DFSORT do you have? Paste the ICE201I message from a step.

New User

Joined: 05 Mar 2009
Posts: 20
Location: Pune

Posted: Fri Feb 20, 2015 4:54 pm    Post subject:

 Quote: I meant there is no data after 10th column ( thats where |G| is). But the LRECL of file is 5000. DFSORT used is V1.13.
Bill Woodger

DFSORT Moderator

Joined: 09 Mar 2011
Posts: 7314

 Posted: Fri Feb 20, 2015 7:30 pm    Post subject: Reply to: Replace Data before a delimiter in VB file using S The quote tags are for when you want to quote from a previous post, or from another source. No need to use it for your own typing. You mean that you need the LRECL of the file to be 5000 even though the data is nowhere near that length? DFSORT is going to use the LRECL of the input file for the output file without other indications. You've not shown the code you are using. I'd have expected the PARSEd field to have a FIXLEN for the lrecl minus a few for all the possible fields being empty. This will give you a bus-load of blanks at the end of each record. Do you mean this is not what you want (I doubt this is what you want, but don't know if this is your question). To get rid of the blanks, use OUTFIL with VLTRIM.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Line numbers contains last 6 digits o... selvagukan TSO/ISPF 4 Mon Apr 22, 2019 8:32 pm How can I close a flat file in Ezytrieve dibyendumandal11111 CA Products 3 Wed Apr 17, 2019 2:19 pm Pipe Delimited File to xpand thesumitk COBOL Programming 15 Tue Apr 02, 2019 1:02 pm Split input file into multiple files ... srini24 DFSORT/ICETOOL 1 Sat Mar 30, 2019 9:39 pm How to copy\replace the members in pr... abdulrafi JCL & VSAM 6 Fri Mar 22, 2019 7:02 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us