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

Finding a string and concatinating multiple lines


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

New User


Joined: 09 Jan 2020
Posts: 8
Location: USA

PostPosted: Thu Jan 09, 2020 5:59 pm
Reply with quote

Hello all,
Please help me in the below requirement.
I am having FB file of length 22800. Need to search set of strings and built a new VB file lenfth 22800. Issue here is the strings can be in the same line or on multiple lines.

INPUT File:
00HD01.....HEADER.12/13/2019.2019347.0001ABC1..26.12/13/2019.2019347.0910...845UOIF98
7098098548743513213254313321321321231343JSADKLFJLKJLJFNLJSNFNLHJKLJHJKL
HF02ABC2840795904375907693679836759385794587902ABC22984750U5O4JOJ
Search strings are
1. 00HD01
2. 01ABC1
3. 02ABC2
4. 03ABC3
5. 04ABC4

NEEDED OUTPUT :
1. 00HD01.....HEADER.12/13/2019.2019347.00
2. 01ABC1..26.12/13/2019.2019347.0910...845UOIF987098098548743513213254313321321321231343JSADKLFJLKJLJFNLJSNFNLHJKLJHJKLHF
3. 02ABC28407959043759076936798367593857945879
4. 02ABC22984750U5O4JOJ

Thanks in advance.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Jan 09, 2020 7:22 pm
Reply with quote

You should not be having to fix other people's data. Get them to format their dataset (not file) correctly.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Thu Jan 09, 2020 7:32 pm
Reply with quote

ArunkumarGanesan wrote:
Please help me in the below requirement.
I am having FB file of length 22800. Need to search set of strings and built a new VB file lenfth 22800. Issue here is the strings can be in the same line or on multiple lines.

What is so called "file length"???!!!

ArunkumarGanesan wrote:


INPUT File:
00HD01.....HEADER.12/13/2019.2019347.0001ABC1..26.12/13/2019.2019347.0910...845UOIF98
7098098548743513213254313321321321231343JSADKLFJLKJLJFNLJSNFNLHJKLJHJKL
HF02ABC2840795904375907693679836759385794587902ABC22984750U5O4JOJ

What is this garbage???!!!

ArunkumarGanesan wrote:

NEEDED OUTPUT :
1. 00HD01.....HEADER.12/13/2019.2019347.00
2. 01ABC1..26.12/13/2019.2019347.0910...845UOIF987098098548743513213254313321321321231343JSADKLFJLKJLJFNLJSNFNLHJKLJHJKLHF
3. 02ABC28407959043759076936798367593857945879
4. 02ABC22984750U5O4JOJ

Request the "file supplier" to provide you with correct input data.
This would be the best solution.
Back to top
View user's profile Send private message
ArunkumarGanesan

New User


Joined: 09 Jan 2020
Posts: 8
Location: USA

PostPosted: Thu Jan 09, 2020 8:29 pm
Reply with quote

Hey Nic,

Thanks for the correction. Provided the same solution but no hope. so data set need to be corrected from our end.

Hey sergeyken,

input file is a FB file of 22800 bytes length.
The data provided is a sample. requested the vendor to provide in the correct format but no hope as i said.

Is there any way to build the needed output? Thanks for your precious time .
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Thu Jan 09, 2020 9:04 pm
Reply with quote

ArunkumarGanesan wrote:
Hey sergeyken,

input file is a FB file of 22800 bytes length.


I have to repeat my question: what exactly does this mean???
From my point of view, this statement is a bullshit.
Did you RTFM on zOS dataset characteristics???
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Thu Jan 09, 2020 9:07 pm
Reply with quote

ArunkumarGanesan wrote:
Is there any way to build the needed output? Thanks for your precious time .

There is a chance of doing this when using REXX (as the most simple solution).

With REXX, you can convert an input garbage to an output garbage.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Thu Jan 09, 2020 9:13 pm
Reply with quote

If the file is not excessively large, you could write a Rexx Exec to accomplish your task.

Read one line a time.
Search each line for 'line breaks' 01ABC1 or 02ABC2.
Build output record and write when line break found.
Write final record.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Thu Jan 09, 2020 9:37 pm
Reply with quote

Read more (or at least something!) about the differences between two entities:
1) "files" - with "file length" - in Unixlandia, and
2) "datasets" - with their characteristics in zOS world
Back to top
View user's profile Send private message
ArunkumarGanesan

New User


Joined: 09 Jan 2020
Posts: 8
Location: USA

PostPosted: Thu Jan 09, 2020 11:02 pm
Reply with quote

Thank you sergeyken. Sure i will do it.
Thank you everyone for the suggestions.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Fri Jan 10, 2020 12:11 am
Reply with quote

I'm afraid there is no chance this task to be done, ever.

It's against my rules, to give a ready solution to those who is not able to think in terms other than computer games.
But there are rare exceptions, when I'm in good mood.
Code:
 /* REXX */                                                           
 UNIXPROC:                                                             
                                                                       
 Keys = '00HD01 01ABC1 02ABC2 03ABC3 04ABC4'                           
 Key# = Words(Keys)                                                   
                                                                       
 "NEWSTACK"                                                           
 "EXECIO * DISKR UNIXIN (FINIS"                                       
 "EXECIO 0 DISKW DSOUT  (OPEN"                                         
 NewLine = ''                                                         
 KeyLen = 0                                                           
 Do iLine = 1 By 1 While Queued() > 0                                 
    Parse Pull ExtraLine .     /* read record until the first blank */
    NewLine = NewLine || ExtraLine                                     
    Do While NewLine > ''                                             
       Do iKey = 1 to Key#                                             
          NewKey = Word( Keys, iKey )                                 
          KeyPos = Pos( NewKey, NewLine, KeyLen + 1 )                 
          If KeyPos > 0 Then Do                                       
             KeyLen = Length(NewKey)                                   
             Leave iKey                                               
          End                                                         
       End iKey                                                       
       If KeyPos = 0 Then /* append extra input line */               
          Iterate iLine                                               
                                                                       
       If KeyPos > 1 Then Do                                           
          Push Left( NewLine, KeyPos - 1 )                       
          "EXECIO 1 DISKW DSOUT"                                       
       End                                                             
       NewLine = Substr( NewLine, KeyPos )                             
    End                                                               
 End iLine                                                             
 If NewLine > '' Then Do /* do not forget the last portion of data */
    Push NewLine                                                       
    "EXECIO 1 DISKW DSOUT"                                             
 End                                                                   
 "EXECIO 0 DISKW DSOUT (FINIS"                                         
 "DELSTACK"                                                           
                 
 Return 0         

Code:
//*=====================================================================
//* RUN REXX TEST                                                       
//*=====================================================================
//UNIXFILE EXEC PGM=IKJEFT01,                                           
//             PARM=('%UNIXPROC')                                       
//*                                                                     
//SYSEXEC  DD  DISP=(OLD,PASS),DSN=&SYSUID..REXXLIB                           
//*                                                                     
//SYSTSPRT DD  SYSOUT=*                                                 
//DSOUT    DD  SYSOUT=*,DCB=(RECFM=VB,LRECL=28000,BLKSIZE=0)           
//SYSTSIN  DD  DUMMY                                                   
//UNIXIN   DD  *                                                       
00HD01.....HEADER.12/13/2019.2019347.0001ABC1..26.12/13/2019.2019347.09
10...845UOIF98                                                         
7098098548743513213254313321321321231343                               
JSADKLFJLKJLJFNLJSNFNLHJKLJHJKL                                       
HF02ABC2840795904375907693679836759385794587902ABC22984750U5O4JOJ     
//*     


Code:
********************************* TOP OF DATA **********************************
00HD01.....HEADER.12/13/2019.2019347.00                                         
01ABC1..26.12/13/2019.2019347.0910...845UOIF98709809854874351321231343JSADKLFJLKJLJFNLJSNFNLHJKLJHJKLHF
02ABC28407959043759076936798367593857945879     
02ABC22984750U5O4JOJ                                                           
******************************** BOTTOM OF DATA ********************************
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Fri Jan 10, 2020 12:24 am
Reply with quote

Nice job sergeyken. I started coding (for fun), but you are faster than me.
Back to top
View user's profile Send private message
ArunkumarGanesan

New User


Joined: 09 Jan 2020
Posts: 8
Location: USA

PostPosted: Fri Jan 10, 2020 2:21 am
Reply with quote

Hello sergeyken,

I started writing a cobol program for this. But you are awesome. Thank you so much for liberating your rules for me. Thank you so much for your valuable time.

Thanks every one for your time and helping me with some valuable suggestions ..
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 Finding and researching jobs All Other Mainframe Topics 0
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top