Posted: Fri May 14, 2021 10:02 am Post subject: Extract various values - same record
Good day, need this forum assistance to accomplish the following.
Have a seq. dataset, RECFM=FB,LRECL=1070 with multiple accounts and their types. There could be up to 11 occurrences of account+type within the same record.
I need to write those accounts that have type = 4 to an output dataset. Each account number is unique and should start in position 1 of their own record in the output.
Input data.
Layout.
Code:
Ref Field Name Picture Type Start End Length
1 1 DETAIL-RECORD-1 AN 1 1070 1070
2 2 PARTNER-DATA X(29) AN 1 29 29
3 2 ACC-1 X(8) AN 30 37 8
4 2 TYPE-1 X AN 38 38 1
5 2 ACC-2 X(8) AN 39 46 8
6 2 TYPE-2 X AN 47 47 1
7 2 ACC-3 X(8) AN 48 55 8
8 2 TYPE-3 X AN 56 56 1
9 2 ACC-4 X(8) AN 57 64 8
10 2 TYPE-4 X AN 65 65 1
11 2 ACC-5 X(8) AN 66 73 8
12 2 TYPE-5 X AN 74 74 1
13 2 ACC-6 X(8) AN 75 82 8
14 2 TYPE-6 X AN 83 83 1
15 2 ACC-7 X(8) AN 84 91 8
16 2 TYPE-7 X AN 92 92 1
17 2 ACC-8 X(8) AN 93 100 8
18 2 TYPE-8 X AN 101 101 1
19 2 ACC-9 X(8) AN 102 109 8
20 2 TYPE-9 X AN 110 110 1
21 2 ACC-10 X(8) AN 111 118 8
22 2 TYPE-10 X AN 119 119 1
23 2 ACC-11 X(8) AN 120 127 8
24 2 TYPE-11 X AN 128 128 1
I did a DFSort step with OUTREC IFTHEN=(WHEN=(38,1,CH,EQ,C'4'),BUILD=(1:30,8),HIT=NEXT), referencing all occurrences, and was still getting just the first occurrence of type=4 within a record. Then I realized that I cannot write account#'s to the same output position, so in the BUILD st-ts I started outputting them to different output positions, but was still getting just the first occurrence of type=4.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum