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
 

 

Replace Data before a delimiter in VB file using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Trinadh

New User


Joined: 05 Mar 2009
Posts: 18
Location: Pune

PostPosted: Wed Feb 11, 2015 9:18 pm    Post subject: Replace Data before a delimiter in VB file using SORT
Reply with quote

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
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Wed Feb 11, 2015 10:32 pm    Post subject: Reply to: Replace Data before a delimiter in VB file using S
Reply with quote

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.
Back to top
View user's profile Send private message
Trinadh

New User


Joined: 05 Mar 2009
Posts: 18
Location: Pune

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

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
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Thu Feb 12, 2015 1:07 pm    Post subject: Reply to: Replace Data before a delimiter in VB file using S
Reply with quote

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.
Back to top
View user's profile Send private message
Trinadh

New User


Joined: 05 Mar 2009
Posts: 18
Location: Pune

PostPosted: Thu Feb 12, 2015 1:56 pm    Post subject:
Reply with quote

A single space would be enough instead of number of characters for 4th and 5th delimited data.

Thank you.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

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

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))         
Back to top
View user's profile Send private message
Trinadh

New User


Joined: 05 Mar 2009
Posts: 18
Location: Pune

PostPosted: Thu Feb 19, 2015 6:04 pm    Post subject:
Reply with quote

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
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Thu Feb 19, 2015 6:38 pm    Post subject: Reply to: Replace Data before a delimiter in VB file using S
Reply with quote

I'm not sure what you mean. Can you give an example? Shortened representative input and expected output.
Back to top
View user's profile Send private message
Trinadh

New User


Joined: 05 Mar 2009
Posts: 18
Location: Pune

PostPosted: Thu Feb 19, 2015 7:35 pm    Post subject:
Reply with quote

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]
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Fri Feb 20, 2015 4:23 am    Post subject: Reply to: Replace Data before a delimiter in VB file using S
Reply with quote

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.
Back to top
View user's profile Send private message
Trinadh

New User


Joined: 05 Mar 2009
Posts: 18
Location: Pune

PostPosted: Fri Feb 20, 2015 4:54 pm    Post subject:
Reply with quote

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.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Fri Feb 20, 2015 7:30 pm    Post subject: Reply to: Replace Data before a delimiter in VB file using S
Reply with quote

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.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Is the 'prompt' data for the DSLIST p... Willy Jensen TSO/ISPF 2 Tue Dec 06, 2016 4:38 am
No new posts How to move a long alphanumeric data ... lind sh COBOL Programming 6 Mon Dec 05, 2016 7:51 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm


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