Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
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
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
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
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
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...
With nowadays "managers" I'm ready to any situation...
are You sure ?
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
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 *******************
Joined: 15 Aug 2015 Posts: 1245 Location: Bamberg, Germany
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