Joined: 22 Mar 2009 Posts: 161 Location: South Africa
Hi,
I have a VB file with the following records:
Code:
----+----1----+- ---2----+----3----+----4----+----5----+----6----+---
********************************* TOP OF DATA 0 / *
3 al m@10 ATSBATSBTEST AABDUAL BUSVCC X
3 al m 10 ATSBATSBTEST AABDUAL BUSVCC X
3 al m@10 ATSBATSBTEST AABDUAL BUSVCC G
3 al m 10 ATM8ATM8TEST AABDUAL BUSVCC G
3 d* m@10 ELS0ELS0TEST AABDUAL VLUBCC X
3 d* m 10 ELS0ELS0TEST AABDUAL VLUBCC X
3 e m@10 AAAAAAAATEST AABDUAL VLUBCC G
3 e m 10 AAAAAAAATEST AABDUAL VLUBCC G
3 m@10 AAAAAAAATEST AABDUAL VLDDBT X
3 m 10 AAAAAAAATEST AABDUAL VLDDBT X
3 m@10 AAAAAAAATEST AAVDUAL VLDDBT G
3 m 10 AAAAAAAATEST AAVVDUAL VLDDBT G
******************************** BOTTOM OF DATA ********************
I want to include the transactions(i.e.col 25 length 4) ATSB OR ELS0 OR ELS1 and the record type =3(i.e. col 1 length 1).
Also I need to format the output file:
If it is ATSB transaction then C' I MADE CHANGES'.
If it is ELS0 transaction then C' U MADE CHANGES'.
MY SORT CARD IS AS FOLLOWS AND NOT SURE IT IS A CORRECT APPROACH:
Code:
OPTION COPY
INCLUDE COND=(01,01,CH,EQ,C'3',AND,(25,4,CH,EQ,C'ATSB',
OR,25,4,CH,EQ,C'ELS0',OR,25,4,CH,EQ,C'ELS1'))
OUTREC IFTHEN=(WHEN=INIT,
BUILD=(1:6,9,11:25,4)),
OUTREC IFTHEN=(WHEN=(25,4,CH,EQ,C'ATSB'),
OVERLAY=(11:C'I MADE CHANGES ')),
OUTREC IFTHEN=(WHEN=(25,4,CH,EQ,C'ELS0'),
OVERLAY=(11:C'U MADE CHANGES '))
RECORD TYPE=F,LENGTH=80
Joined: 22 Mar 2009 Posts: 161 Location: South Africa
Code:
ICE802I 0 BLOCKSET TECHNIQUE IN CONTROL
ICE007A 1 SYNTAX ERROR
ICE002I 0 DUPLICATE OR CONFLICTING OUTREC STATEMENT
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
ICE002I 0 DUPLICATE OR CONFLICTING OUTREC STATEMENT
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
ICE751I 0 C5-K62149 C6-K90026 C7-K58148 C8-K67572 E7-K70685
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
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 - 12:37 ON THU JU
OPTION COPY
INCLUDE COND=(01,01,CH,EQ,C'3',AND,(25,4,CH,EQ,C'ATSB',
OR,25,4,CH,EQ,C'ELS0',OR,25,4,CH,EQ,C'ELS1'))
OUTREC IFTHEN=(WHEN=INIT,
BUILD=((1:6,9,11:25,4)),
OUTREC IFTHEN=(WHEN=(25,4,CH,EQ,C'ATSB'),
ICE002I 0 DUPLICATE OR CONFLICTING OUTREC STATEMENT
OVERLAY=(11:C'I MADE CHANGES ')),
$
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
OUTREC IFTHEN=(WHEN=(25,4,CH,EQ,C'ELS0'),
ICE002I 0 DUPLICATE OR CONFLICTING OUTREC STATEMENT
OVERLAY=(11:C'U MADE CHANGES '))
$
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
RECORD TYPE=F,LENGTH=80
ICE751I 0 C5-K62149 C6-K90026 C7-K58148 C8-K67572 E7-K70685
ICE052I 3 END OF DFSORT
my output should be:
Code:
111111111 I MADE CHANGES
111111112 I MADE CHANGES
111111132 I MADE CHANGES
111111231 U MADE CHANGES
111111243 U MADE CHANGES
the first 9 digits of output file is hexadecimal value from the input file from position 2(i.e. position 6 as it is VB) with length 9
which is S9(17)
Joined: 22 Mar 2009 Posts: 161 Location: South Africa
Thanks Naish for your correction. So dumb I am. The job ran fine without issue.
Now the output for the desire outrec also came fine.
Coming to the first 9 digit from input file which are hexadecimal value are not getting displayed. Is there any solution for that.
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
it is all hexadecimal on z/OS.
what you mean is non display characters,
which means the field is either binary or packed-decimal.
since it is obvious you have no clue,
view the file and use the hex on option.
then cut and paste the results of a few records for the 1st 10 or so positions,
and someone will tell you what is there.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
abhijit.nayak01,
Couple of errors with your control cards.
1. You can only specify 1 OUTREC parm.
2. When you use WHEN=INIT, you already modified the record, the subsequent IFTHEN should be based on the modified record by WHEN=INIT
3. Since your Input is a VB and you want a FB file you need to use the parm VTOF
If I understand your requirement correctly the following DFSORT JCL will give you the desired results
OUTFIL VTOF,
BUILD=(5,23,X,
24,4,CHANGE=(20,C'ATSB',C'I MADE CHANGES',
C'ELS0',C'U MADE CHANGES',
C'ELS1',C'NO ONE CHANGED'),80:X)
//*
If you insist on using IFTHEN then use the following control cards
Code:
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(5,1,ZD,EQ,3,AND,25,4,SS,EQ,C'ATSB,ELS0,ELS1')
INREC BUILD=(1,4,6,9,PD,M26,X,25,4)
OUTREC IFOUTLEN=84,
IFTHEN=(WHEN=(24,4,CH,EQ,C'ATSB'),OVERLAY=(29:C'I MADE CHANGES')),
IFTHEN=(WHEN=(24,4,CH,EQ,C'ELS0'),OVERLAY=(29:C'U MADE CHANGES')),
IFTHEN=(WHEN=(24,4,CH,EQ,C'ELS1'),OVERLAY=(29:C'NO ONE CHANGED'))
OUTFIL VTOF,BUILD=(5,80)
//*
The output would be
Code:
+00000000000000001 ATSB I MADE CHANGES
+00000000000000002 ATSB I MADE CHANGES
+00000000000000003 ATSB I MADE CHANGES
+00000000000000005 ELS0 U MADE CHANGES
+00000000000000006 ELS0 U MADE CHANGES
Joined: 22 Mar 2009 Posts: 161 Location: South Africa
Hi,
Sorry for the late response as I started work now. The above one with IFTHEN worked fine and I ussed the exatly the same one. I got the following output:
Code:
+05120570300121171 ATSB I MADE CHANGES.
Can you please tell me how I am going to remove the +0.
And can you please explan me from INREC statement.
Meanwhile I am unfortunate that the requirement got chnaged and now they only want ATSB and dont want "I MADE CHANGES" as the file can only be length of 80 and there are some new fields which I need to insert into the output file.
On the previous posts I only removed the multiple outrec statements as suggested and that worked fine.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
abhijit.nayak01 wrote:
Hi,
Sorry for the late response as I started work now. The above one with IFTHEN worked fine and I ussed the exatly the same one. I got the following output:
Code:
+05120570300121171 ATSB I MADE CHANGES.
Can you please tell me how I am going to remove the +0.
And can you please explan me from INREC statement.
abhijit.nayak01,
Your PD field can contain both positive and negative numbers. What do you plan to do with the signs? or do you always have ONLY positive numbers?
The explanation of INREC.
1,4 = RDW
6,9,PD = your input PD field at pos 6 for 9 bytes.
M26 = predefined edit mask . Check this link for Table 42. Edit Mask Patterns
X = Space
25,4 = your input field at pos 25 for 4 bytes.
Now if you need to add any other fields then you can add them at the end.
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
Joined: 22 Mar 2009 Posts: 161 Location: South Africa
HI Kolusu,
Can you plaese assist on below:
when I am using a single SORTIN file the job is running fine with the desired output mentioned above but when I am using two sortin files its giving syntax error. Here the two input files are same.
ICE805I 1 JOBNAME: DAN1FRSB , STEPNAME: SRT01#06
ICE802I 0 BLOCKSET TECHNIQUE IN CONTROL
ICE201I H RECORD TYPE IS V - DATA STARTS IN POSITION 5
ICE078A 1 VSAM OPEN ERROR (188) SORTIN
ICE023A 0 NO LENGTH OPERAND
ICE150I 0 VLSHRT NOT USED FOR SORT, MERGE, INCLUDE, OMIT OR SUM STATEMENT FIELDS
ICE751I 0 C5-K62149 C6-K90026 C7-K58148 C8-K67572 EE-K72040 E7-K70685
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
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 - 14:29 ON TUE JU
SORT FIELDS=COPY
INCLUDE COND=(5,1,CH,EQ,C'3',AND,25,4,SS,EQ,C'ATSB,ELS0,ELS1')
OUTFIL VTOF,BUILD=(5,80)
OPTION VLSHRT
CE201I H RECORD TYPE IS V - DATA STARTS IN POSITION 5
CE078A 1 VSAM OPEN ERROR (188) SORTIN
CE023A 0 NO LENGTH OPERAND
CE150I 0 VLSHRT NOT USED FOR SORT, MERGE, INCLUDE, OMIT OR SUM STATEMENT FIELDS
CE751I 0 C5-K62149 C6-K90026 C7-K58148 C8-K67572 EE-K72040 E7-K70685
CE052I 3 END OF DFSORT
Joined: 22 Mar 2009 Posts: 161 Location: South Africa
Thanks, I never knew that VSAM datasets cant be concatenated. So, now I have to use two steps for two files and concatenate both the sortout the files.