IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

update trailer count at specific position and date


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 128
Location: UK

PostPosted: Fri Mar 12, 2010 1:52 pm
Reply with quote

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
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Mar 12, 2010 2:26 pm
Reply with quote

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
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 128
Location: UK

PostPosted: Fri Mar 12, 2010 3:12 pm
Reply with quote

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
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Mar 12, 2010 3:39 pm
Reply with quote

What control statements did you use?

Edit mask could be the solution to supressing zeros.
Back to top
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 128
Location: UK

PostPosted: Fri Mar 12, 2010 4:37 pm
Reply with quote

Code:

//SYSIN   DD    * 
  OPTION COPY
  OUTFIL REMOVECC,   
      TRAILER1=(COUNT=(M11,LENGTH=9))
Back to top
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 128
Location: UK

PostPosted: Fri Mar 12, 2010 6:34 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Mar 12, 2010 9:59 pm
Reply with quote

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
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 128
Location: UK

PostPosted: Mon Mar 15, 2010 2:35 pm
Reply with quote

Thanks Kolusu,

What things need to be changed if i have to use Fixed Block output file of RL=127.

Rgrd
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Mar 15, 2010 2:48 pm
Reply with quote

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
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 128
Location: UK

PostPosted: Mon Mar 15, 2010 2:50 pm
Reply with quote

No Imput is same ( VB,RL= 131)
Back to top
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 128
Location: UK

PostPosted: Mon Mar 15, 2010 3:43 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Mar 15, 2010 9:43 pm
Reply with quote

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
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 128
Location: UK

PostPosted: Tue Mar 16, 2010 12:16 am
Reply with quote

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
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 128
Location: UK

PostPosted: Tue Mar 16, 2010 10:42 am
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Mar 16, 2010 11:34 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Mar 16, 2010 10:46 pm
Reply with quote

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
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 128
Location: UK

PostPosted: Wed Mar 17, 2010 5:52 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Mar 17, 2010 9:36 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Mar 17, 2010 11:21 pm
Reply with quote

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

icon_smile.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Mar 17, 2010 11:39 pm
Reply with quote

And the related commands icon_rolleyes.gif

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
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 128
Location: UK

PostPosted: Wed Mar 17, 2010 11:57 pm
Reply with quote

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
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 128
Location: UK

PostPosted: Thu Mar 25, 2010 7:42 pm
Reply with quote

Kolusu,

In case input file is empty Trailer record get truncated.i.e

Code:
'FOOTER|SERVICENAME|PEGA|NUMBEROFPROCESSEDRECORDS|


Please suggest
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Mar 25, 2010 9:33 pm
Reply with quote

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
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 128
Location: UK

PostPosted: Fri Mar 26, 2010 12:54 am
Reply with quote

Kolusu,

Can you suggest me the code changes ?

Rgrds
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Mar 26, 2010 1:46 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top