Could you please help me with a solution for my requirement.
I have the flat file of 39 LRECL with data as below
- 3 char Seq, 3 char Num, 8 char date (4 occurrences), 1 char ID
Code:
001ABC20210930 U
002DEF202107302021110520211203 U
003XYZ2020051020210410 U
004WRT U
Output should be - Each record with multiple date occurrence should come one below another as shown below with the output LRECL as 16 byte. If the date is not there, the record should be displayed as it is.
Format is 3 char Seq, 3 char Num, 8 char Date, 1 char space, 1 char ID
Code:
001ABC20210930 U
002DEF20210730 U
002DEF20211105 U
002DEF20211203 U
003XYZ20200510 U
003XYZ20210410 U
004WRT U
Can you please let me know whether this requirement can be accomplished using SORT or should I need to go with COBOL program.
Thanks very much Joerg.
I just tried this logic with 4 date occurrences as I have mentioned in my requirement and it worked.
I was asked, whether date occurrences can be increased from 4 to 50. So whether in that case, should we need to have the
IFTHEN statement 50 times covering all the 50 positions where date will come. Or whether there is any other way.
Joined: 15 Aug 2015 Posts: 1245 Location: Bamberg, Germany
Chidane wrote:
I was asked, whether date occurrences can be increased from 4 to 50. So whether in that case, should we need to have the
IFTHEN statement 50 times covering all the 50 positions where date will come.
You can repeat the logic for more fields of course. If you use PARSE and symbols it will be easier to fulfill the requirement. See with four parsed fields:
If I have the date occurrences as 50 (coming in fixed positions), whether I need to have 50 BUILD statements or whether there is any other way to get this done.
Thanks Joerg.
I have tried SYM and it seems to be non supporting.
I am trying COBOL program for the same.
The IFTHEN statement that you have mentioned at first does the job easily and perfectly, however since I have to expand it to 50 date occurrences, I have to code 50 IFTHEN combinations.
Thatz why was checking, to avoid COBOL programming way.
Thanks for the suggestion.