Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Finding a string and concatinating multiple lines

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

New User


Joined: 09 Jan 2020
Posts: 4
Location: USA

PostPosted: Thu Jan 09, 2020 5:59 pm    Post subject: Finding a string and concatinating multiple lines
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: 2274
Location: Hampshire, UK

PostPosted: Thu Jan 09, 2020 7:22 pm    Post subject: Reply to: Finding a string and concatinating multiple lines
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

Active Member


Joined: 29 Apr 2008
Posts: 667
Location: Maryland

PostPosted: Thu Jan 09, 2020 7:32 pm    Post subject: Re: Finding a string and concatinating multiple lines
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: 4
Location: USA

PostPosted: Thu Jan 09, 2020 8:29 pm    Post subject:
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

Active Member


Joined: 29 Apr 2008
Posts: 667
Location: Maryland

PostPosted: Thu Jan 09, 2020 9:04 pm    Post subject:
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

Active Member


Joined: 29 Apr 2008
Posts: 667
Location: Maryland

PostPosted: Thu Jan 09, 2020 9:07 pm    Post subject:
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: 729
Location: Pennsylvania

PostPosted: Thu Jan 09, 2020 9:13 pm    Post subject:
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

Active Member


Joined: 29 Apr 2008
Posts: 667
Location: Maryland

PostPosted: Thu Jan 09, 2020 9:37 pm    Post subject:
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: 4
Location: USA

PostPosted: Thu Jan 09, 2020 11:02 pm    Post subject:
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

Active Member


Joined: 29 Apr 2008
Posts: 667
Location: Maryland

PostPosted: Fri Jan 10, 2020 12:11 am    Post subject:
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: 729
Location: Pennsylvania

PostPosted: Fri Jan 10, 2020 12:24 am    Post subject:
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: 4
Location: USA

PostPosted: Fri Jan 10, 2020 2:21 am    Post subject:
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    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 How to include header and some detail... AllyDick DFSORT/ICETOOL 2 Sun Dec 08, 2019 10:19 pm
No new posts Is multiple program names allowed in ... Sakthidevi PL/I & Assembler 1 Tue Nov 19, 2019 11:12 pm
No new posts Count From Multiple Inputs Tyler Dunbar DFSORT/ICETOOL 5 Tue Nov 12, 2019 1:07 am
No new posts Merging lines knobi DFSORT/ICETOOL 4 Mon Nov 04, 2019 10:57 pm
No new posts String to ASCII conversion JPLMARTINS COBOL Programming 4 Sun Sep 29, 2019 12:00 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us