IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Include Group record based on detail records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Thu Mar 12, 2020 1:54 pm
Reply with quote

Hello All,

I have a file with VB and 133 file length look like

Code:
DSNT1111 dataline 1
            dataline 2
            dataline 3
           nn statements where is ap successful
           nn statements where is not successful or partially
           successful
           nn statements where ap could not be performed
           nn statements where ap was suppressed by other hints
 
  DSNT2222 dataline 1
          data
          data
 data
 data
 DSNT1111 dataline 11
            dataline 21
            dataline 31
           nn statements where is ap successful
           nn statements where is not successful or partially
           successful
           nn statements where ap could not be performed
           nn statements where ap was suppressed by other hints
 DSNT2222 dataline 1
          data
          data
 


Now we need group of records of DSNT1111 where we have at least 1 number of statement which is not successful, not performed or suppressed.

I have written below code to get all the DSNT1111 group but not surehow to check non zero condition in multiple details records

Code:
SORT FIELDS =COPY
INREC  IFTHEN=(WHEN=GROUP, BEGIN=(6,4,CH,EQ,C'DSNT'),
           PUSH=(134:6,8)),
OUTFIL INCLUDE=(134,8,EQ,C'DSNT1111'),
BUILD=(1,133)


Kindly advise
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Thu Mar 12, 2020 6:27 pm
Reply with quote

Two passes are required - either via ICETOOL/SYNCTOOL, or in two JCL steps of DFSORT/SYNCSORT

1) detect the DSNT1111 groups, and mark them via PUSH
2) detect the lines with "not successful, not performed or suppressed", and mark them within each group
3) create intermediate "selector" file out of unique group IDs where at least one "specific" line is marked.
4) perform INNER JOIN between original file with group IDs, and intermediate "selector" file with only required unique group IDs

There is exactly the same issue in the Beginners Forum
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Thu Mar 12, 2020 8:46 pm
Reply with quote

Hello Sergeyken,

Thanks for your response.

I have question on detect the lines with "not successful, not performed or suppressed", and mark them within each group.

I need to select only those group where there is a non zero "not successful, not performed or suppressed" like

i/p
Code:

DSNT1111 dataline 1
            dataline 2
            dataline 3
           35 statements where is ap successful
           0 statements where is not successful or partially
           successful
           0 statements where ap could not be performed
           0 statements where ap was suppressed by other hints
 
  DSNT2222 dataline 1
          data
          data
 data
 data
 DSNT1111 dataline 11
            dataline 21
            dataline 31
           49 statements where is ap successful
           1 statements where is not successful or partially
           successful
           2 statements where ap could not be performed
           0 statements where ap was suppressed by other hints
 DSNT2222 dataline 1
          data
          data


Output should be
Code:
DSNT1111 dataline 11
            dataline 21
            dataline 31
           49statements where is ap successful
           1statements where is not successful or partially
           successful
           2 statements where ap could not be performed
           0 statements where ap was suppressed by other hints


Please advise
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Thu Mar 12, 2020 9:12 pm
Reply with quote

guptae wrote:
Please advise

Please, take the given example from the Beginners Forum as a template.
Functionally, it is EXACTLY the same task as yours.

This Forum is supposed to give some hints, and advises, but NOT any ready-to-copy-and-paste solutions.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Fri Mar 13, 2020 5:25 pm
Reply with quote

As I can see, the TS is not interested in learning something, or apply his thinking abilities?

The only difference from the Beginners Forum example is: detection of numeric value 0, and distinguish it from non-0? Is this subtask also not clear?

From the initial topic it's not obvious: is the input really a "free text description" split into separate lines in unpredicted order???
Code:
     1 statements where is not successful or partially
            successful

If so, you may need to write a simple (or not very simple) syntax parser, before starting the task mentioned in the original message.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1245
Location: Bamberg, Germany

PostPosted: Fri Mar 13, 2020 5:49 pm
Reply with quote

From the MSG I would conclude it's DSNT286I, that is not that much free form.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Fri Mar 13, 2020 6:16 pm
Reply with quote

Joerg.Findeisen wrote:
From the MSG I would conclude it's DSNT286I, that is not that much free form.

Who knows where it comes from?
Maybe, the TS received this "input" via e-mail from his manager, who requested to "immediately analyze it, and automate this process"?

With nowadays "managers" I'm ready to any situation...
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Mar 13, 2020 6:46 pm
Reply with quote

Quote:
With nowadays "managers" I'm ready to any situation...

are You sure ? icon_wink.gif

too many topics ago I had a flame war with somebody who instead of contacting the proper inside support structure
kept pestering because his PHB(*) told him to pursue his issues on external forums disregarding available inside competences

(*) Pointed Head Boss
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Fri Mar 13, 2020 11:31 pm
Reply with quote

No chance to inspire some quest to start thinking on his own.

Maybe it would help to someone else...
Code:
//*================================================================
//* SELECT DATA ON SPECIAL GROUPS                                 
//*================================================================
//SORTGRP EXEC PGM=ICETOOL                                         
//*                                                               
//TOOLMSG  DD  SYSOUT=*                                           
//DFSMSG   DD  SYSOUT=*                                           
//REPORT   DD  SYSOUT=*                                           
//*                                                               
//SORTIN   DD  *                                                   
DSNT1111 dataline 1                                               
   dataline 2                                                     
   dataline 3                                                     
  00 statements where is ap successful                             
  00 statements where is not successful or partially successful   
  00 statements where ap could not be performed                   
  00 statements where ap was suppressed by other hints             
                                                                   
   DSNT2222 dataline 1                                             
           data                                                   
           data                                                   
  data                                                             
  data                                                             
  DSNT1111 dataline 11                                             
   dataline 21                                                     
   dataline 31                                                     
  01 statements where is ap successful                             
  01 statements where is not successful or partially successful   
  01 statements where ap could not be performed                   
  01 statements where ap was suppressed by other hints             
  DSNT2222 dataline 1                                             
           data                                                   
           data                                                   
//*                                                               
//*----------------------------------------------------------------
//TOOLIN   DD  *                                                   
  COPY FROM(SORTIN) TO(SELECTOR)    USING(S001)                   
  COPY JKFROM       TO(SORTOUT)     USING(S002)                   
//*                                                               
//*------------------------------------------------------------------
//S001CNTL DD  *                                                     
 INREC IFTHEN=(WHEN=GROUP,                                           
               BEGIN=(1,80,SS,EQ,C'DSNT1111'),                       
               PUSH=(81:ID=5)),                                     
*      first type of counters                                       
       IFTHEN=(WHEN=(10,70,SS,EQ,L(C' not successful ',             
                                   C' not be performed ',           
                                   C' suppressed ')),               
               PARSE=(%1=(STARTAT=NONBLANK,                         
                          ENDBEFR=C' ',                             
                          FIXLEN=5)),                               
               OVERLAY=(86:%1,UFF,EDIT=(TTTTT))),                   
*      second type of counters                                       
       IFTHEN=(WHEN=(10,70,SS,EQ,C' successful '),                   
               PARSE=(%2=(STARTAT=NONBLANK,                         
                          ENDBEFR=C' ',                             
                          FIXLEN=5)),                               
               OVERLAY=(91:%2,UFF,EDIT=(TTTTT)))                     
 OUTFIL FNAMES=(SELECT@,SELECTOR),                                   
        REMOVECC,NODETAIL,                                           
        SECTIONS=(81,5,                                             
        TRAILER3=(81,5,                                             
                  TOTAL=(86,5,ZD,EDIT=(TTTTT)),   sum of counters1   
                  TOTAL=(91,5,ZD,EDIT=(TTTTT))))  sum of counters2   
 OUTFIL FNAMES=(NUMBER@,NUMBERED)                                   
//*                                                                 
//*------------------------------------------------------------------
//S002CNTL DD  *                                                     
 JOINKEYS F1=NUMBERED,                                               
          FIELDS=(81,5,A),SORTED                                     
 JOINKEYS F2=SELECTOR,                                               
          INCLUDE=(06,5,ZD,GT,+0),                                   
          FIELDS=(1,5,A),SORTED                                     
 REFORMAT FIELDS=(F1:1,80)                                           
//*                                                                 
//*------------------------------------------------------------------
//SELECT@  DD  SYSOUT=*                                             
//SELECTOR DD  DISP=(NEW,DELETE),                                   
//             UNIT=SYSDA,SPACE=(TRK,(5,5)),           
//             DSN=&&SELECTOR                           
//NUMBER@  DD  SYSOUT=*                                 
//NUMBERED DD  DISP=(NEW,DELETE),                       
//             UNIT=SYSDA,SPACE=(TRK,(500,500)),       
//             DSN=&&NUMBERED                           
//*                                                     
//SORTOUT  DD  SYSOUT=*                                 
//*                                                     
//*===================================================== 

Code:
********************************* TOP OF DATA *********************
  DSNT1111 dataline 11                                             
   dataline 21                                                     
   dataline 31                                                     
  01 statements where is ap successful                             
  01 statements where is not successful or partially successful   
  01 statements where ap could not be performed                   
  01 statements where ap was suppressed by other hints             
  DSNT2222 dataline 1                                             
           data                                                   
           data                                                   
******************************** BOTTOM OF DATA ******************* 
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1245
Location: Bamberg, Germany

PostPosted: Sat Mar 14, 2020 3:34 am
Reply with quote

Another approach..
Code:
//DSNTFILT EXEC PGM=ICEMAN                                         
//F1       DD *                                                   
DSNT1111 dataline 1                                               
   dataline 2                                                     
   dataline 3                                                     
  47 statements where is ap successful                             
  00 statements where is not successful or partially successful   
  00 statements where ap could not be performed                   
  00 statements where ap was suppressed by other hints             
                                                                   
   DSNT2222 dataline 1                                             
           data                                                   
           data                                                   
  data                                                             
  data                                                             
  DSNT1111 dataline 11                                             
   dataline 21                                                     
   dataline 31                                                     
  01 statements where is ap successful                             
  01 statements where is not successful or partially successful   
  01 statements where ap could not be performed                   
  01 statements where ap was suppressed by other hints             
  DSNT2222 dataline 1                                             
           data                                                   
           data                                                   
/*                                                                 
//F2       DD .. <* has exactly the same content as DD:F1                                                   
//SYSOUT   DD SYSOUT=*                                             
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  JOINKEYS F1=F1,FIELDS=(81,5,A),TYPE=F                           
  JOINKEYS F2=F2,FIELDS=(81,5,A),TYPE=F                           
  REFORMAT FIELDS=(F1:1,80,F2:86,8)                               
  SORT FIELDS=(COPY)                                               
  OUTFIL FNAMES=(SORTOUT),                                         
    OMIT=(81,8,BI,EQ,+0),                                         
    BUILD=(1,80)                                                   
  END                                                             
/*                                                                 
//JNF1CNTL DD *                                                   
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(86:8Z)),                       
    IFTHEN=(WHEN=GROUP,BEGIN=(1,80,SS,EQ,C'DSNT1111'),             
      END=(1,80,SS,EQ,C' by other hints '),PUSH=(81:ID=5))         
  END                                                             
/*                                                                 
//JNF2CNTL DD *                                                   
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(86:8Z)),                       
    IFTHEN=(WHEN=GROUP,BEGIN=(1,80,SS,EQ,C'DSNT1111'),             
      END=(1,80,SS,EQ,C' by other hints '),PUSH=(81:ID=5)),       
    IFTHEN=(WHEN=(1,80,SS,EQ,C' statements where ',AND,               
                  (1,80,SS,EQ,C' not ',OR,1,80,SS,EQ,C' performed ')),
      PARSE=(%01=(STARTAT=NUM,ENDBEFR=BLANKS,FIXLEN=8)),             
        OVERLAY=(86:%01,UFF,TO=BI,LENGTH=8))                         
  SUM FIELDS=(86,8,BI)                                               
  END                                                                 
/*

Code:
  DSNT1111 dataline 11                                           
   dataline 21                                                   
   dataline 31                                                   
  01 statements where is ap successful                           
  01 statements where is not successful or partially successful 
  01 statements where ap could not be performed                 
  01 statements where ap was suppressed by other hints
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1245
Location: Bamberg, Germany

PostPosted: Sat Mar 14, 2020 1:52 pm
Reply with quote

Minor update: In DD:JNF2CNTL replace the word
Code:
performed
with
Code:
suppressed
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Sun Mar 15, 2020 12:30 am
Reply with quote

enrico-sorichetti wrote:
Quote:
With nowadays "managers" I'm ready to any situation...

are You sure ? icon_wink.gif


MANAGER AND PLUMBER
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top