|
View previous topic :: View next topic
|
| Author |
Message |
zh_lad
Active User
Joined: 06 Jun 2009 Posts: 115 Location: UK
|
|
|
|
Hi,
My VB file has groupd of records, header and detailed records, no trailer. I want to reject those group of records which have
p=52,l=2,CH,value '11' and p=62,l=1,CH value'11'
Key is on p=25,l=27
Input file format = VB
LRECL = 431
I have tried JOINKEYS but results are not proper.
| Code: |
//SORTJNF1 DD DSN=MY VB INPUT FIL1......
//SORTJNF2 DD DSN=MY VB INPUT FIL1......
//SORTOF01 DD DSN=OUTPUT1 - STORES MATCHED RECORD
//SORTOF02 DD DSN=OUTPUT2 - RECORD WITHOUT 11 AND Y
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(29,27,A)
JOINKEYS FILE=F2,FIELDS=(29,27,A)
* Added 4 bytes to all the location as input is VB
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,431,?)
SORT FIELDS=COPY
OUTFIL FILES=01,INCLUDE=(432,1,CH,EQ,C'B')
OUTFIL FILES=02,INCLUDE=(432,1,CH,EQ,C'2')
/*
//JNF1CNTL DD *
INCLUDE COND=(56,2,CH,EQ,C'11',&,68,1,CH,EQ,C'Y')
* Added 4 bytes to all the location as input is VB
/*
//JNF2CNTL DD *
OPTION COPY
/* |
The output file is FB of 432 length. It should have been VB and 431
| Code: |
| ICE419I 0 JOINED RECORDS: TYPE=F, LENGTH=432 |
Could you please help me with this SORT JCL.
When I try
| Code: |
| REFORMAT FIELDS=(F1:1,435,?) |
I am getting:
| Code: |
| ICE414A 0 SORTJNF1 (F1) REFORMAT FIELD END AT 435 IS BEYOND LENGTH OF 431 |
Thanks,
zh_lad |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You have made the REFORMAT record fixed-length.
| Code: |
| REFORMAT FIELDS=(F1:1,4,?,F1:5) |
The 5 on its own says "position 5 to the end of the variable-length record"
You'll need to change the 432,1s to 5,1s and add BUILD onto each of the OUTFILs.
The 6 on its own says approximately the same as the above. |
|
| Back to top |
|
 |
zh_lad
Active User
Joined: 06 Jun 2009 Posts: 115 Location: UK
|
|
|
|
Thanks.
I am getting Syntax error on REFORMAT FIELD:
| Code: |
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01,
JOINKEYS FILE=F1,FIELDS=(29,27,A)
JOINKEYS FILE=F2,FIELDS=(29,27,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,4,?,5)
£
ICE007A D SYNTAX ERROR |
my updated SORT code is:
| Code: |
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(29,27,A)
JOINKEYS FILE=F2,FIELDS=(29,27,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,4,?,5)
SORT FIELDS=COPY
* 'B' EXTRACT RECORDS FOUND IN BOTH THE FILES
OUTFIL FILES=01,INCLUDE=(5,1,CH,EQ,C'B'),BUILD=(1,4,6)
* '2' EXTRACT RECORDS FOUND IN FILE 2 BUT NOT IN 1
OUTFIL FILES=02,INCLUDE=(5,1,CH,EQ,C'2'),BUILD=(1,4,6)
/*
//JNF1CNTL DD *
INCLUDE COND=(56,2,CH,EQ,C'11',&,68,1,CH,EQ,C'Y')
/*
//JNF2CNTL DD *
OPTION COPY
/* |
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Yep, my fault, typing too quickly. You need F1: in front of the 5 on the REFORMAT. |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
the explanation is/was pretty foggy ...
I guess that every record header / detail has the key
Key is on p=25,l=27
I guess also that the
p=52,l=2,CH,value '11' and p=62,l=1,CH value'11'
occurs in the header
if the above is true
and You can distinguish the header from the other records
the clauses GROUP, PUSH, OMIT, BUILD should be enough to provide the desired output.
why not post a simplified example just the significant fields
( the key can be shorter to save some typing )
input and expected output ! |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
zh_lad,
You have OPTION COPY in JNF2CNTL, but don't have SORTED on the JOINKEYS for F2, so your F2 file will get sorted anyway. |
|
| Back to top |
|
 |
zh_lad
Active User
Joined: 06 Jun 2009 Posts: 115 Location: UK
|
|
|
|
| enrico-sorichetti wrote: |
the explanation is/was pretty foggy ...
I guess that every record header / detail has the key
Key is on p=25,l=27 - Yes
I guess also that the
p=52,l=2,CH,value '11' and p=62,l=1,CH value'11'
occurs in the header - Yes
if the above is true
and You can distinguish the header from the other records
the clauses GROUP, PUSH, OMIT, BUILD should be enough to provide the desired output. - Sure
why not post a simplified example just the significant fields
( the key can be shorter to save some typing ) - See below
input and expected output ! |
Input:
| Code: |
NWBNAB11 6BX 00000000G4098168000000575823675335021111 D MR C MIC
NWBNAB11 6BX 00000000G4098168000000575823675335021212 201AB11 6B
NWBNAB11 6BX 00000000G40981680000005758236753350222000000001DThe amoun
NWBNAB11 6BX 00000000G4098175000000575849000000001111 DYMR J MIC
NWBNAB11 6BX 00000000G4098175000000575849000000001212 201AB11 6B
NWBNAB11 6BX 00000000G40981750000005758490000000021000000001Transactio |
Output1
| Code: |
NWBNAB11 6BX 00000000G4098168000000575823675335021111 D MR C MIC
NWBNAB11 6BX 00000000G4098168000000575823675335021212 201AB11 6B
NWBNAB11 6BX 00000000G40981680000005758236753350222000000001DThe amoun |
Output2
| Code: |
NWBNAB11 6BX 00000000G4098175000000575849000000001111 DYMR J MIC
NWBNAB11 6BX 00000000G4098175000000575849000000001212 201AB11 6B
NWBNAB11 6BX 00000000G40981750000005758490000000021000000001Transactio |
I have tried this SORT Card:
| Code: |
INREC IFTHEN=(WHEN=GROUP,BEGIN=(56,2,CH,EQ,C'11',&,
68,1,CH,EQ,C'Y'),
PUSH=(436:56,2))
OPTION COPY,VLSHRT
OUTFIL FNAMES=SORTOUT1,INCLUDE=(436,2,CH,EQ,C'11'),
BUILD=(5,431)
OUTFIL FNAMES=SORTOUT2,BUILD=(5,431),SAVE |
and I am getting this error:
| Code: |
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 13:23 ON MON NO
INREC IFTHEN=(WHEN=GROUP,BEGIN=(56,2,CH,EQ,C'11',&,
68,1,CH,EQ,C'Y'),
PUSH=(436:56,2))
OPTION COPY,VLSHRT
OUTFIL FNAMES=SORTOUT1,INCLUDE=(436,2,CH,EQ,C'11'),
BUILD=(5,431)
OUTFIL FNAMES=SORTOUT2,BUILD=(5,431),SAVE
ICE201I H RECORD TYPE IS V - DATA STARTS IN POSITION 5
ICE150I 0 VLSHRT NOT USED FOR SORT, MERGE, INCLUDE, OMIT OR SUM STATEMENT FIELDS
ICE251A 9 MISSING RDW OR DATA FOR SORTOUT1: REASON CODE 03, IFTHEN 0
ICE751I 0 C5-K62149 C6-K90026 C7-K58148 C8-K67572 E9-K60824 E7-K70685
ICE052I 3 END OF DFSORT |
I always struggle in SORT card when input is a VB file. Please advice.
Thanks,
zh_lad |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
When temporarily "extending" a record with PUSH/OVERLAY/BUILD, if the record is fixed in length, you do it at the end of the record. If the record is variable in length, you do it at the beginning, to avoid making all the records a fixed-length in a VB dataset.
This will take the RDW from the original file (all you need to do, DFSORT will do the adjustments to it), makes 20 bytes of space to be overlayed/pushed late and copies from position 5 until the end of the current record.
In your code, you have missed out on the RDW (the problem you know about) and have made all the records the same length (a problem you don't yet realise). |
|
| Back to top |
|
 |
zh_lad
Active User
Joined: 06 Jun 2009 Posts: 115 Location: UK
|
|
|
|
Thanks. Tried this:
| Code: |
INREC IFTHEN=(WHEN=GROUP,BEGIN=(56,2,CH,EQ,C'11',&,
68,1,CH,EQ,C'Y'),
BUILD=(1,4,2X,5),
PUSH=(1:56,2))
OPTION COPY,VLSHRT
OUTFIL FNAMES=SORTOUT1,INCLUDE=(5,2,CH,EQ,C'11'),BUILD=(1,431)
OUTFIL FNAMES=SORTOUT2,BUILD=(1,431),SAVE |
and I am getting:
| Code: |
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 15:10 ON MON NO
INREC IFTHEN=(WHEN=GROUP,BEGIN=(56,2,CH,EQ,C'11',&,
68,1,CH,EQ,C'Y'),
BUILD=(1,4,2X,5),
£
ICE107A F DUPLICATE, CONFLICTING, OR MISSING INREC OR OUTREC STATEMENT OPERANDS
PUSH=(1:56,2))
£
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
OPTION COPY,VLSHRT
OUTFIL FNAMES=SORTOUT1,INCLUDE=(5,2,CH,EQ,C'11'),BUILD=(1,431)
OUTFIL FNAMES=SORTOUT2,BUILD=(1,431),SAVE
ICE751I 0 C5-K62149 C6-K90026 C7-K58148 C8-K67572 E7-K70685 |
It appears BUILD can not be used in first pass. How do I first BUILD and then PUSH?
Many thanks. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
| Code: |
| IFTHEN=(WHEN=INIT,BUILD=( |
Use that to establish the space for the PUSH in the WHEN=(GROUP. |
|
| Back to top |
|
 |
zh_lad
Active User
Joined: 06 Jun 2009 Posts: 115 Location: UK
|
|
|
|
Thanks. Tried this:
| Code: |
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,2X,5)),
IFTHEN=(WHEN=GROUP,BEGIN=(58,2,CH,EQ,C'11',&,
70,1,CH,EQ,C'Y'),
PUSH=(5:58,2))
OPTION COPY,VLSHRT
OUTFIL FNAMES=SORTOUT1,INCLUDE=(5,2,CH,EQ,C'11'),
BUILD=(1,431),VLFILL=C' '
OUTFIL FNAMES=SORTOUT2,BUILD=(1,431),VLFILL=C' ',SAVE |
It does not give correct results. I noticed two problems, there could be more:
First problem:
| Code: |
11NWBNAB11 6BX 00000000G4098175000000575849000000001111 DYMR J MICHIE
11NWBNAB11 6BX 00000000G4098175000000575849000000001212 201AB11 6BX 81
11NWBNAB11 6BX 00000000G40981750000005758490000000021000000001Transaction Char |
Its keeping PUSHed part on output record.
Second problem:
SORTOUT1 is having record which are NOT (64,1,CH,EQ,C'Y'). |
|
| Back to top |
|
 |
zh_lad
Active User
Joined: 06 Jun 2009 Posts: 115 Location: UK
|
|
|
|
I have solved my first problem using:
| Code: |
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,7:5)),
IFTHEN=(WHEN=GROUP,BEGIN=(58,2,CH,EQ,C'11',&,
70,1,CH,EQ,C'Y'),
PUSH=(5:58,2))
OPTION COPY,VLSHRT
OUTFIL FNAMES=SORTOUT1,INCLUDE=(5,2,CH,EQ,C'11'),
BUILD=(1,4,5:7),VLFILL=C' '
OUTFIL FNAMES=SORTOUT2,BUILD=(1,4,5:7),VLFILL=C' ',SAVE |
However, it seems, part:
| Code: |
70,1,CH,EQ,C'Y'),
PUSH=(5:58,2)) |
is not working, specially first part. For some reason, it is including record even it has space.
| Code: |
NWBNAB11 6BX 00000000G4098175000000575849000000001111 DYMR J MIC
NWBNAB11 6BX 00000000G4098178000000575849000000001111 DYMR J MIC
NWBNAB11 6BX 00000000G4147967000000575849000000001111 S MR J MIC |
Third record shouldn't have appear on SORTOUT1 file. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You are defining a group of records. The way you are defining it, all records are in a group once the first group definition is located and until the next group definition is located.
If you have something which "ends" the group of records, you can specify that on the IFTHEN. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|