MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Extract various values - same record

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
ramy2016
Beginner


Joined: 18 Apr 2016
Posts: 47
Topics: 15

PostPosted: Fri May 14, 2021 10:02 am    Post subject: Extract various values - same record Reply with quote

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


Code:

PARTNER-DATA                 ACC#1   T1 ACC#2   T2 ACC#3   T3 ACC#4   T4 ACC#5   T5 ACC#6   T6 ACC#7   T7 ACC#8   T8 ACC#9   T9 ACC#10 T10 ACC#11 T11
PARTNER-1....................ZD111111 1 ZD222222 1 ZD333333 4 ZD444444 1 ZD555555 4 ZD666666 1                                               
PARTNER-2....................AB111111 1 AB222222 4                                                 
PARTNER-3....................CC111111 4 CC222222 2                                                 
PARTNER-4....................KL111111 2 KL222222 1 KL333333 1 KL444444 2 KL555555 1 KL666666 1 KL777777 1 KL888888 1 KL999999 1                                               
PARTNER-5....................FF111111 4
PARTNER-6....................WD111111 1


Expected Output.
Code:

ZD333333
ZD555555
AB222222
CC111111
FF111111


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.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri May 14, 2021 10:37 am    Post subject: Reply with quote

ramy2016,

Use the following DFSORT/ICETOOL JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                     
//TOOLMSG  DD SYSOUT=*                           
//DFSMSG   DD SYSOUT=*                           
//INP      DD DISP=SHR,DSN=Your.Input.FB.1070.Byte.file
//OUT      DD SYSOUT=*                           
//TOOLIN   DD *                                 
  RESIZE FROM(INP) TO(OUT) TOLEN(9) USING(CTL1) 
//CTL1CNTL DD *                                 
  INREC BUILD=(30,99)                           
  OUTFIL FNAMES=OUT,                             
  INCLUDE=(9,1,CH,EQ,C'4'),                     
  BUILD=(1,8)                                   
/*   

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ramy2016
Beginner


Joined: 18 Apr 2016
Posts: 47
Topics: 15

PostPosted: Fri May 14, 2021 10:53 am    Post subject: Reply with quote

kolusu,
That's beautiful!
Thank you.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group