View previous topic :: View next topic
Author
Message
shr_amar Warnings : 2 Active User Joined: 02 May 2005Posts: 128 Location: UK
Hello All ,
I need to do the following :-
I have input file(VB , RL= 131) which have data as follows
Frst record is a header.
HHHHHHHHHHHHHHHH
xyzaAxxxx|XXXXXX|YYYYYYYY
ccccccccc|yyyyyy|zzzzzzzz
I wish to wrtite a o/p file(VB) include a trailer record which should be in a format given below
HHHHHHHHHHHHHHHH
xyzaAxxxx|XXXXXX|YYYYYYYY
ccccccccc|yyyyyy|zzzzzzzz
FOOTER|ServiceName|PEGA|NumberOfProcessedRecords|3|ExtractReturnCode|0|ExtractDate|20100312
|3| is the value of number of detail records which is a variable
20100312 is the date O/P file is created.
Please let me know in case more info is required
Back to top
vasanthz Global Moderator Joined: 28 Aug 2007Posts: 1742 Location: Tirupur, India
There are numerous threads similar to this requirement. search the forum.
Also "SMART DFSORT TRICKS" Pdf has a solution to your requirement.(if u are using DFSORT)
Back to top
shr_amar Warnings : 2 Active User Joined: 02 May 2005Posts: 128 Location: UK
I got the solution of the above requirement from the forum .
Now i am looking to supress Zero from my trailer count
e.g
i/p file
yyy
zzz
aaa
o/p file
yyy
zzz
aaa
003
i want to supress leading zero from the trailing count .
Back to top
vasanthz Global Moderator Joined: 28 Aug 2007Posts: 1742 Location: Tirupur, India
What control statements did you use?
Edit mask could be the solution to supressing zeros.
Back to top
shr_amar Warnings : 2 Active User Joined: 02 May 2005Posts: 128 Location: UK
Code:
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,
TRAILER1=(COUNT=(M11,LENGTH=9))
Back to top
shr_amar Warnings : 2 Active User Joined: 02 May 2005Posts: 128 Location: UK
I have tried with edit pattern M10,But it is giving me leading spaces
i want count to display actual count of the records.
eg if the file contains 9 records it should write 9 only without any spaces or leading zeroes .
COUNT=(M10,LENGTH=9)
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
shr_amr,
Use the folllowing DFSORT JCL which will give you the desired results
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=your input vb file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,SEQNUM,9,ZD,
C'|EXTRACTRETURNCODE|0|EXTRACTDATE|',DATE1,5)),
IFTHEN=(WHEN=INIT,OVERLAY=(5:5,9,ZD,M10,LENGTH=9)),
IFTHEN=(WHEN=INIT,OVERLAY=(5:5,50,JFY=(SHIFT=LEFT)))
OUTFIL REMOVECC,BUILD=(1,4,55),
TRAILER1=('FOOTER|SERVICENAME|PEGA|NUMBEROFPROCESSEDRECORDS|',5,50)
//*
Back to top
shr_amar Warnings : 2 Active User Joined: 02 May 2005Posts: 128 Location: UK
Thanks Kolusu,
What things need to be changed if i have to use Fixed Block output file of RL=127.
Rgrd
Back to top
Escapa Senior Member Joined: 16 Feb 2007Posts: 1399 Location: IL, USA
shr_amar wrote:
What things need to be changed if i have to use Fixed Block output file of RL=127.
Rgrd
How about input? Input is still VB or even input is FB RL=127?
Back to top
shr_amar Warnings : 2 Active User Joined: 02 May 2005Posts: 128 Location: UK
No Imput is same ( VB,RL= 131)
Back to top
shr_amar Warnings : 2 Active User Joined: 02 May 2005Posts: 128 Location: UK
I have tried to take output in the FB RL=127, With the following card changed .
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=your input vb file,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,SEQNUM,9,ZD,
C'|EXTRACTRETURNCODE|0|EXTRACTDATE|',DATE1,5)),
IFTHEN=(WHEN=INIT,OVERLAY=(5:5,9,ZD,M10,LENGTH=9)),
IFTHEN=(WHEN=INIT,OVERLAY=(5:5,50,JFY=(SHIFT=LEFT)))
OUTFIL VTOF,REMOVECC,BUILD=(1,4,55),
TRAILER1=('FOOTER|SERVICENAME|PEGA|NUMBEROFPROCESSEDRECORDS|',5,50)
//*
ADDED VTOF option but getting given below error
ICE126A 9 INCONSISTENT REFORMATTING FOR SORTOUT : REASON CODE 02, IFTHEN 0
Please advise
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
shr_amar,
If you want FB 127 LRECL output then it is just 1 line change. Change the OUTFIL statement in my job to the following
Code:
OUTFIL VTOF,REMOVECC,BUILD=(55,127),
Back to top
shr_amar Warnings : 2 Active User Joined: 02 May 2005Posts: 128 Location: UK
Thanks Kolusu ,
I know that in VB first four byte is RDW and data start from 5 byte. Will it be possible for you to tell me what the diffrence here in
BUILD=(55,127), &
BUILD=(1,4,55),
I am new to DFSORT so i apologise if i am asking very basic question's
Regards
Back to top
shr_amar Warnings : 2 Active User Joined: 02 May 2005Posts: 128 Location: UK
Kolusu ,
I have changed outfil statement to BUILD=(55,127), Its not working .Error coming out is :-
ICE027A 9 END OF SORTOUT FIELD BEYOND MAXIMUM RECORD LENGTH
Back to top
Escapa Senior Member Joined: 16 Feb 2007Posts: 1399 Location: IL, USA
shr_amar wrote:
Kolusu ,
I have changed outfil statement to BUILD=(55,127), Its not working .Error coming out is :-
ICE027A 9 END OF SORTOUT FIELD BEYOND MAXIMUM RECORD LENGTH
Post complete SYSOUT messages(use code tag).
I feel SORTOUT is having different LRECL than 127
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
shr_amar,
Kolusu's VTOF job works as coded. In order to get the ICE027A, you must have something different in your job.
You need to post your complete JCL source and the complete //SYSOUT messages you received in order for us to help you.
Back to top
shr_amar Warnings : 2 Active User Joined: 02 May 2005Posts: 128 Location: UK
I have tried given below code to fullfil my requiremnt which are as follows
1) Input file is a VB ,131 byte long , the first byte of the input file contain spaces.
2) In output file i want to copy all the data into a FB 126 byte long file (excluding first byte of the input file).
Rules are
Write fixed text header record with date in output file
copy all the data of the input file to o/p starting from 2 byte to 131 byte ( As first byte is space that need to be ommited)
write
write trailer with count .
while executing my code i am getting error
ICE218A 6 5 BYTE VARIABLE RECORD IS SHORTER THAN 12 BYTE MINIMUM FOR FI
//S00001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=INPUT.FILE (VB,RL131),DISP=SHR
//SORTOUT DD DSN=OUTPUT.FILE (FB,RL126),DISP=SHR
//SYSIN DD *
OMIT COND=(5,8,CH,EQ,C'|||||||')
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,SEQNUM,9,ZD,
C'|TESTTESTHHHHHHHHHHHHHHHHHHHHHHHH',DATE1,5)),
IFTHEN=(WHEN=INIT,OVERLAY=(5:5,9,ZD,M10,LENGTH=9)),
IFTHEN=(WHEN=INIT,OVERLAY=(5:5,50,JFY=(SHIFT=LEFT)))
OUTFIL VTOF,REMOVECC,BUILD=(55,126),
HEADER1=('TESTNAME_BBBBBBBBBBBBBDGFHGGHGHHHILEELTTTTTTTTTTTTTTTTTTTTY'
TESTAGAINTESTAGAINOTESTAGAINTESTAGAINATED'),
TRAILER1=('THIS:ISATESTTRAIERNUMBEROFRECORDPROCESSEDRECORDS|',5,50)
/*
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
shr_amar,
Boy. Isn't it a nice shooting practice with a moving target? You show "n" different scenarios and provide very little information.
Let's see you started with ICE027A and when asked to show what you changed you come back with ICE218A? Whatever happened to the previous error?
You wanted an FB output file of 127 and now you change it to Fb 126? Are you even sure what you really want?
*Sigh* Use the following control cards
Code:
//SYSIN DD *
OMIT COND=(5,8,CH,EQ,C'|||||||')
OPTION COPY,VLSCMP
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,SEQNUM,9,ZD,
C'|EXTRACTRETURNCODE|0|EXTRACTDATE|',DATE1,5)),
IFTHEN=(WHEN=INIT,OVERLAY=(5:5,9,ZD,M10,LENGTH=9)),
IFTHEN=(WHEN=INIT,OVERLAY=(5:5,50,JFY=(SHIFT=LEFT)))
OUTFIL VTOF,REMOVECC,BUILD=(56,126),
TRAILER1=('FOOTER|SERVICENAME|PEGA|NUMBEROFPROCESSEDRECORDS|',5,50)
//*
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
When adding new functonality to dfsort/icetool, i believe it is time to implement DWIM capability. . . .
Once upon a time, i made some DWIM keyboard keys for "special users" (these were some of our brightest users, but they had a horrible time migrating from character screens to Windows) using blank "chicklets", clear typing tape, and 2-sided tape to attach to the keyboard.
DWIM = Do What I Meant
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
And the related commands
DWIWNWITYTD - Do what I wanted, not what I told you to do
DWIDKIW - Do what I didn't know I wanted
DIA - Do it all
RMM - Read my mind
FOWIW - Figure out what I want
and so on
Back to top
shr_amar Warnings : 2 Active User Joined: 02 May 2005Posts: 128 Location: UK
Kolusu ,
I agree with the remark. This also points that while getting solution to the requirement i also wish to learn various situation's.I know there are many handbooks present on platform.But some one well said
A single conversation with a wise man is better than ten years of study
I know that you guys are having excellent command over this utility and becuse of this people need support everytime from all of you .
I will test the code and lt you know the outcome
Warm regards
Back to top
shr_amar Warnings : 2 Active User Joined: 02 May 2005Posts: 128 Location: UK
Kolusu,
In case input file is empty Trailer record get truncated.i.e
Code:
'FOOTER|SERVICENAME|PEGA|NUMBEROFPROCESSEDRECORDS|
Please suggest
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
shr_amar wrote:
Kolusu,
In case input file is empty Trailer record get truncated.i.e
Code:
'FOOTER|SERVICENAME|PEGA|NUMBEROFPROCESSEDRECORDS|
Please suggest
It is NOT truncating. Since there are no data records we are not building any thing and since you wanted to squeeze and do other things we had to build the values on the data records and when your input is empty you get only the hard coded part of the trailer. You need to check for empty file and then check the return code and set the trailer accordingly
Back to top
shr_amar Warnings : 2 Active User Joined: 02 May 2005Posts: 128 Location: UK
Kolusu,
Can you suggest me the code changes ?
Rgrds
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
shr_amar wrote:
Kolusu,
Can you suggest me the code changes ?
Rgrds
*sigh*
Code:
//******************************************************************
//* SET A RC=4 IF THE INPUT FILE IS EMPTY *
//******************************************************************
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&VB,DISP=SHR
//SORTOUT DD DUMMY
//SYSIN DD *
OPTION COPY,STOPAFT=1,NULLOUT=RC4
//*
//******************************************************************
//* EXECUETE THIS STEP ONLY WHEN INPUT FILE IS EMPTY *
//******************************************************************
//STEP0200 EXEC PGM=SORT,COND=(0,EQ,STEP0100)
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&VB,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL VTOF,REMOVECC,BUILD=(5,126),
TRAILER1=('FOOTER|SERVICENAME|PEGA|NUMBEROFPROCESSEDRECORDS|',
'0|EXTRACTRETURNCODE|0|EXTRACTDATE|',DATENS=(4MD))
//*
//******************************************************************
//* EXECUETE THIS STEP ONLY WHEN INPUT FILE IS NOT EMPTY *
//******************************************************************
//STEP0300 EXEC PGM=SORT,COND=(4,EQ,STEP0100)
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&VB,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OMIT COND=(5,8,CH,EQ,C'|||||||')
OPTION COPY,VLSCMP
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,SEQNUM,9,ZD,
C'|EXTRACTRETURNCODE|0|EXTRACTDATE|',DATE1,5)),
IFTHEN=(WHEN=INIT,OVERLAY=(5:5,9,ZD,M10,LENGTH=9)),
IFTHEN=(WHEN=INIT,OVERLAY=(5:5,50,JFY=(SHIFT=LEFT)))
OUTFIL VTOF,REMOVECC,BUILD=(56,126),
TRAILER1=('FOOTER|SERVICENAME|PEGA|NUMBEROFPROCESSEDRECORDS|',5,50)
//*
Back to top
Please enable JavaScript!