|
View previous topic :: View next topic
|
| Author |
Message |
Ramsee
New User
.jpg)
Joined: 06 Jan 2011 Posts: 53 Location: Chennai
|
|
|
|
Hi All,
I need to write a file based on the below logic:
| Code: |
ABC -----------------1
DEF -----------------1
GHI -----------------1
ABC----------------2
DEF----------------2
GHI----------------2
ABC---------------3
GHI---------------3
|
Above mentioned was the Input i need to write the O/P File as follows,
| Code: |
ABC----------------1
DEF---------------1
GHI--------------1
ABC---------------2
DEF---------------2
GHI--------------2 |
Here the Third Group will be skipped as the immediate record starting with the position DEF is missing.
Kindly help me out. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Ramsee,
Please answer the following questions
1. Does every group start with 'ABC'?
2. Is it always 3 records per group?
3. What is the LRECL and RECFM of the input file?
4. Please run the following JCL and show us the sysout which helps us to determine the level of DFSORT you running.
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
RECORD
/*
//SORTOUT DD DUMMY
//SYSIN DD *
OPTION COPY
/* |
|
|
| Back to top |
|
 |
Ramsee
New User
.jpg)
Joined: 06 Jan 2011 Posts: 53 Location: Chennai
|
|
|
|
Hi Skolusu,
The file is of VB Format with 22900 as record length, the DEF may occur as any record(Not restricted to second) within the group.
Please find the SYSOUT Display
1ICE201I H RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE751I 0 C5-K62149 C6-K90026 C7-K58148 C8-K67572 E9-K60824 C9-BASE E5-K72040
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES A
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 18:50 ON TUE O
0 OPTION COPY
ICE201I H RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE751I 0 C5-K62149 C6-K90026 C7-K58148 C8-K67572 E9-K60824 C9-BASE E5-K72040
ICE193I 0 ICEAM1 INVOCATION ENVIRONMENT IN EFFECT - ICEAM1 ENVIRONMENT SELECTED
ICE088I 0 NNPR3TOA.S1 . , INPUT LRECL = 80, BLKSIZE = 80, TYPE = FB
ICE093I 0 MAIN STORAGE = (MAX,6291456,6278238)
ICE156I 0 MAIN STORAGE ABOVE 16MB = (6200798,6200798)
ICE127I 0 OPTIONS: OVFLO=RC0 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC16,VLSCMP=N,SZERO=Y
ICE128I 0 OPTIONS: SIZE=6291456,MAXLIM=1048576,MINLIM=450560,EQUALS=N,LIST=Y,ER
ICE129I 0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=NO ,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT
ICE130I 0 OPTIONS: RESALL=4096,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=Y,OUTREL=Y,CKPT
ICE131I 0 OPTIONS: TMAXLIM=6291456,ARESALL=0,ARESINV=0,OVERRGN=65536,CINV=Y,CFW
ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE ,EXIT
ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE ,EXIT
ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=MAX ,ODMAXBF=0,SOLRF=Y,VLLONG=N,VSAM
ICE235I 0 OPTIONS: NULLOUT=RC0
ICE236I 0 OPTIONS: DYNAPCT=10 ,MOWRK=Y
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTOUT
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTIN
ICE751I 1 EF-BASE F0-K66717 E8-K70685
ICE090I 0 OUTPUT LRECL = 80, BLKSIZE = 80, TYPE = FB
ICE055I 0 INSERT 0, DELETE 0
ICE054I 0 RECORDS - IN: 1, OUT: 1
ICE052I 0 END OF DFSORT |
|
| Back to top |
|
 |
senjay
Active User

Joined: 10 May 2007 Posts: 147 Location: India
|
|
|
|
Ramsee,
You still have not replied for Skolusu's questions 1) and 2). Without that, you will not get any help here.
Reg 4) Its enough if you post the 1st line of what you have pasted from your SYSOUT here.
Its always good if you tell us the DFSORT level of your site when you post a query. How to determine that can be seen in:
ibmmainframes.com/viewtopic.php?t=33389 |
|
| Back to top |
|
 |
Ramsee
New User
.jpg)
Joined: 06 Jan 2011 Posts: 53 Location: Chennai
|
|
|
|
Hi All,
I am sorry for the delay,
1. Does every group start with 'ABC'?
Yes
2. Is it always 3 records per group?
It may contain more than 3 records per group. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
OK, if not three, why did your sample data only show three?
Do we have to ask one-at-a-time (is it four? you reply no. is it five? you reply no) or can you describe the grouping to us? |
|
| Back to top |
|
 |
Ramsee
New User
.jpg)
Joined: 06 Jan 2011 Posts: 53 Location: Chennai
|
|
|
|
Hi,
The Input file will be as follows,
| Code: |
ABC -----------------1
DEF -----------------1
GHI -----------------1
JKL------------------1
XYZ-----------------1
ABC----------------2
GHI----------------2
MNO---------------2
DEF----------------2
PQR---------------2
STU---------------2
ABC---------------3
GHI---------------3 |
In the above IF DEF is present we have to write the Group into the file, DEF may present anywhere in the group starting position is 5to7(VB file).
All the Group starts with ABC.
Code'd |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
did You notice that Your initial post was edited to add the CODE tags
using the code tags is a due courtesy to people spending their time to help You
without
123456789012345678901234567890
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrst
with
| Code: |
123456789012345678901234567890
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrst
|
as You can see the info surrounded by the code tags is displayed with a fixed pitch font
making easy for everybody to REread code and jcl |
|
| Back to top |
|
 |
Ramsee
New User
.jpg)
Joined: 06 Jan 2011 Posts: 53 Location: Chennai
|
|
|
|
Hi All,
I seriously apologize for the information that i have posted earlier.
Kindly find the below scenario,
Data as follows
| Code: |
DCST;Y;1;2;I;;;P
DCSA;1;TR 000260
DCSA;1;TR 000260
DCSA;1;TR 000260
DCSA;1;TR 000260
DCTY;1;91245019;
DCTA;1;91245019;
DCTA;1;91245019;
DCTA;1;91245019;
DCTA;1;91245019;
DCST;Y;1;2;I;;;P
DCSA;23;DBTGCBIC
DCSA;23;DBTGCBIC
DCSA;23;DBTGCBIC
DCTY;23;92650638
DCTA;23;92650638
DCTA;23;92650638
DCTA;23;92650638
DCTA;23;92650638
DCTA;23;92650638
DCTA;23;92650638
DCST;Y;1;2;I;;;P
DCSA;22;DBTGCBIC
DCSA;22;DBTGCBIC
DCSA;22;DBTGCBIC
DCTY;22;92650637
DCTA;22;92650637
DCTA;22;92650637
DCTA;22;92650637
DCTA;22;92650637
DCTA;22;92650637
DCTA;22;92650637
DCST;Y;1;2;I;;;P
DCTY;22;92650637
DCTA;22;92650637
DCTA;22;92650637 |
Here the data droup starts with the DCST and always ends with DCTA
I need to extract the Group into a file with having "DCSA" witin the Group.
DCSA may present in any of the occurance within a group or it may have duplicates as well.
single output file should contain as follows
| Code: |
DCST;Y;1;2;I;;;P
DCSA;1;TR 000260
DCSA;1;TR 000260
DCSA;1;TR 000260
DCSA;1;TR 000260
DCTY;1;91245019;
DCTA;1;91245019;
DCTA;1;91245019;
DCTA;1;91245019;
DCTA;1;91245019;
DCST;Y;1;2;I;;;P
DCSA;23;DBTGCBIC
DCSA;23;DBTGCBIC
DCSA;23;DBTGCBIC
DCTY;23;92650638
DCTA;23;92650638
DCTA;23;92650638
DCTA;23;92650638
DCTA;23;92650638
DCTA;23;92650638
DCTA;23;92650638
DCST;Y;1;2;I;;;P
DCSA;22;DBTGCBIC
DCSA;22;DBTGCBIC
DCSA;22;DBTGCBIC
DCTY;22;92650637
DCTA;22;92650637
DCTA;22;92650637
DCTA;22;92650637
DCTA;22;92650637
DCTA;22;92650637
DCTA;22;92650637 |
Here the Last group doesnt have DCSA within the Data group, hence it was ignored in the output file.
Please let me know if i need to give further information. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
OK.
Have a look at the technique with JOINKEYS where you specify the same dataset for both files (many examples here).
In JNF2CNTL you can ignore all except your group definers (if you are not validating, then you only need the header) and the particular data record you want.
Define a GROUP with an ID. If a header, append a value of zero. If data append a value of one.
You only need the ID and the appended value in your output.
SUM on the appended value, so you only get one record per ID.
In the JNF1CNTL apply the same GROUP to get the ID.
Then JOINKEYS on the ID (all must match) and if the F2 has the value "1" then you need to write the group out, else you don't (which can be INCLUDE/OMIT in the COPY step after the JOIN. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Ramsee,
Assuming you ALWAYS have the group header record which starts with DCST, the following DFSORT JCL will give you the desired results.
| Code: |
//STEP0100 EXEC PGM=SORT,REGION=0M
//SYSOUT DD SYSOUT=*
//INA DD DSN=Your Input VB 22900 byte file,DISP=SHR
//INB DD DSN=Same Input VB 22900 byte file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(5,8,A),SORTED,NOSEQCK
JOINKEYS F2=INB,FIELDS=(5,8,A)
REFORMAT FIELDS=(F1:1,4,F2:13,4,F1:13)
OMIT COND=(5,4,ZD,EQ,0)
INREC BUILD=(1,4,9)
//*
//JNF1CNTL DD *
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,8X,5)),
IFTHEN=(WHEN=GROUP,BEGIN=(13,4,CH,EQ,C'DCST'),PUSH=(5:ID=8))
//*
//JNF2CNTL DD *
INCLUDE COND=(5,4,SS,EQ,C'DCST,DCSA')
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,8X,4C'0',5)),
IFTHEN=(WHEN=GROUP,BEGIN=(17,4,CH,EQ,C'DCST'),PUSH=(5:ID=8)),
IFTHEN=(WHEN=(17,4,CH,EQ,C'DCSA'),OVERLAY=(16:C'1DSCT'))
SUM FIELDS=(13,4,ZD)
//* |
|
|
| Back to top |
|
 |
Ramsee
New User
.jpg)
Joined: 06 Jan 2011 Posts: 53 Location: Chennai
|
|
|
|
| Thanks a lot Skolusu for your time and help |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|