IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Replace Data before a delimiter in VB file using SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Trinadh

New User


Joined: 05 Mar 2009
Posts: 20
Location: Pune

PostPosted: Wed Feb 11, 2015 9:18 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Feb 11, 2015 10:32 pm
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: 20
Location: Pune

PostPosted: Thu Feb 12, 2015 11:51 am
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Feb 12, 2015 1:07 pm
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: 20
Location: Pune

PostPosted: Thu Feb 12, 2015 1:56 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Feb 12, 2015 3:12 pm
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: 20
Location: Pune

PostPosted: Thu Feb 19, 2015 6:04 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Feb 19, 2015 6:38 pm
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: 20
Location: Pune

PostPosted: Thu Feb 19, 2015 7:35 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 20, 2015 4:23 am
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: 20
Location: Pune

PostPosted: Fri Feb 20, 2015 4:54 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 20, 2015 7:30 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top