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 

Split record with Include and Omit.

 
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: 40
Topics: 12

PostPosted: Wed Jun 22, 2022 2:44 pm    Post subject: Split record with Include and Omit. Reply with quote

Good day everyone, trying to split multiple occurrences of the same record into multiple separate records under few conditions.
Have a seq. dataset, RECFM=FB,LRECL=685 holding account records with multiple transaction dates + their types. There could be up to 7 occurrences of date+type per record.
I put together a Sort step that does it without problems, the issue is with an OMIT st-t I'm trying to use to avoid picking up empty occurrences. The OMIT is being ignored and I'm getting records without dates in the output.

Condition.
Select all records where REL-CODE = RDL4 and ACCOUNT-DATE/TYPE is not blank. Split each ACCOUNT-DATE/TYPE occurrence into separate record keeping ACCOUNT-NUM.

Input data.
Layout.
Code:

Ref Field Name                                Picture  Type Start    End Length
    ****  Top of data  ****                                                   
  1 1 INPUT-REC                                         AN      1    685    685
  2  2 ACCOUNT-NUM                            X(15)     AN      1     15     15
  3  2 REL-CODE                               X(04)     AN     16     19      4
  4  2 ACCOUNT-TABLE OCCURS 7 TIMES                                           
  4  2 ACCOUNT-TABLE(1)                                 AN     20     29     10
  5   3 ACCOUNT-DATE(1)                       X(08)     AN     20     27      8
  6   3 ACCOUNT-TYPE(1)                       X(02)     AN     28     29      2
  4  2 ACCOUNT-TABLE(2)                                 AN     30     39     10
  5   3 ACCOUNT-DATE(2)                       X(08)     AN     30     37      8
  6   3 ACCOUNT-TYPE(2)                       X(02)     AN     38     39      2
  4  2 ACCOUNT-TABLE(3)                                 AN     40     49     10
  5   3 ACCOUNT-DATE(3)                       X(08)     AN     40     47      8
  6   3 ACCOUNT-TYPE(3)                       X(02)     AN     48     49      2
  4  2 ACCOUNT-TABLE(4)                                 AN     50     59     10
  5   3 ACCOUNT-DATE(4)                       X(08)     AN     50     57      8
  6   3 ACCOUNT-TYPE(4)                       X(02)     AN     58     59      2
  4  2 ACCOUNT-TABLE(5)                                 AN     60     69     10
  5   3 ACCOUNT-DATE(5)                       X(08)     AN     60     67      8
  6   3 ACCOUNT-TYPE(5)                       X(02)     AN     68     69      2
  4  2 ACCOUNT-TABLE(6)                                 AN     70     79     10
  5   3 ACCOUNT-DATE(6)                       X(08)     AN     70     77      8
  6   3 ACCOUNT-TYPE(6)                       X(02)     AN     78     79      2
  4  2 ACCOUNT-TABLE(7)                                 AN     80     89     10
  5   3 ACCOUNT-DATE(7)                       X(08)     AN     80     87      8
  6   3 ACCOUNT-TYPE(7)                       X(02)     AN     88     89      2
  7  2 REST                                   X(596)    AN     90    685    596


Code:

ACCOUNT-NUM        REL-CODE DATE(1)  TYPE(1) DATE(2)  TYPE(2) DATE(3)  TYPE(3) DATE(4)  TYPE(4) DATE(5)  TYPE(5) DATE(6) TYPE(6) DATE(7) TYPE(7)
111111111111111    RDL4     20220217 TR      20220520 SM      20220610 SY
222222222222222    RDL0     20220216 TB      20220531 SO      20220601 SY      20220610 FZ
333333333333333    ARSM     20220111 NN      20220223 MM      20220603 SS      20220610 FZ
444444444444444    RDL4     20220115 CA      20220313 EB      20220517 AY      20220608 OW      20220615 LE


Expected Output.
Code:

111111111111111  20220217 TR
111111111111111  20220520 SM
111111111111111  20220610 SY
444444444444444  20220115 CA
444444444444444  20220313 EB
444444444444444  20220517 AY
444444444444444  20220608 OW
444444444444444  20220615 LE


I did it through the DFSort step below, but the output included all empty DATE/TYPE occurrences preceded with ACCOUNT-NUM. Tried adding an OMIT st-t after OUTFIL BUILD but that had no impact.

Code:

//SYSIN    DD *
  INCLUDE COND=(16,4,CH,EQ,C'RDL4')                                                       
  OPTION COPY
  OUTFIL BUILD=(1,15,20,10,/,1,15,30,10,/,1,15,40,10,/,1,15,50,10,/,   
               1,15,60,10,/,1,15,70,10,/,1,15,80,10) 
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jun 22, 2022 8:08 pm    Post subject: Reply with quote

ramy2016,


Isn't this quite similar to your earlier request ?

https://www.mvsforums.com/helpboards/viewtopic.php?t=13056

If you remembered or searched for resize you could have adapted the above solution to your latest requirement.

Taking that base line solution, you could have simply built the Account-num + Date as array of 7 entries making a 175 byte record and use resize with a TOLEN 25 bytes. Using OMIT on OUTFIL you could have skipped writing the records with spaces in date

Untested DFSORT JCL
Code:

//STEP0100 EXEC PGM=ICETOOL                                   
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//INP      DD DISP=SHR,DSN=Your Input of 685 bytes
//OUT      DD SYSOUT=*                                       
//TOOLIN   DD *                                               
  RESIZE FROM(INP) TO(OUT) TOLEN(25) USING(CTL1)
/*             
//CTL1CNTL DD *                                               
 
  INCLUDE COND=(16,04,CH,EQ,C'RDL4')  # only RDL4             
                                                             
  INREC BUILD=(01,15,20,10,           # Acct-num + Date 1     
               01,15,30,10,           # Acct-num + Date 2     
               01,15,40,10,           # Acct-num + Date 3     
               01,15,50,10,           # Acct-num + Date 4     
               01,15,60,10,           # Acct-num + Date 5     
               01,15,70,10,           # Acct-num + Date 6     
               01,15,80,10)           # Acct-num + Date 7     
                                                             
  OUTFIL FNAMES=OUT,                                         
  OMIT=(16,10,CH,EQ,C' ')             # omit date = space     
/*

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

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: 40
Topics: 12

PostPosted: Fri Jun 24, 2022 11:45 am    Post subject: Reply with quote

Thank you kolusu, I remembered of RESIZE but was wondering if I could use OMIT along with OUTFIL BUILD.
Is it possible at all?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Sat Jun 25, 2022 2:56 pm    Post subject: Reply with quote

ramy2016 wrote:
Thank you kolusu, I remembered of RESIZE but was wondering if I could use OMIT along with OUTFIL BUILD.
Is it possible at all?


OMIT works on RECORD level and not on FIELD level. So if you want to use OUTFIL OMIT then you can code IFTHEN statements to cover all the permutations and combinations. Since you have 7 entries, you will need to 7! (5040 ) to cover all the possible scenarios.

RESIZE is breaking up the 175 bytes record into 7 records and using OMIT will be on the RECORD level.

The goal should be about solving the problem but NOT get fixated on a solution which may work or may not.
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

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: 40
Topics: 12

PostPosted: Sat Jun 25, 2022 5:26 pm    Post subject: Reply with quote

Understood. Thanks for your help.
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