View previous topic :: View next topic
|
Author |
Message |
ArunkumarGanesan
New User
Joined: 09 Jan 2020 Posts: 8 Location: USA
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
You should not be having to fix other people's data. Get them to format their dataset (not file) correctly. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2023 Location: USA
|
|
|
|
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 |
|
|
ArunkumarGanesan
New User
Joined: 09 Jan 2020 Posts: 8 Location: USA
|
|
|
|
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 |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2023 Location: USA
|
|
|
|
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 |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2023 Location: USA
|
|
|
|
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 |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
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 |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2023 Location: USA
|
|
|
|
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 |
|
|
ArunkumarGanesan
New User
Joined: 09 Jan 2020 Posts: 8 Location: USA
|
|
|
|
Thank you sergeyken. Sure i will do it.
Thank you everyone for the suggestions. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2023 Location: USA
|
|
|
|
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 |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Nice job sergeyken. I started coding (for fun), but you are faster than me. |
|
Back to top |
|
|
ArunkumarGanesan
New User
Joined: 09 Jan 2020 Posts: 8 Location: USA
|
|
|
|
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 |
|
|
|