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

JCL SORT CARD to update the trailer record count


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

New User


Joined: 20 Sep 2006
Posts: 63
Location: pune

PostPosted: Tue Jul 21, 2009 11:48 am
Reply with quote

Hi,
I have input file and sorting it on two fields with sum fields = none. In input file I have detail record and trailer
record. Trailer record contains total number of detail records that we have in input file. While sorting with
sum fields = none it's deleting dulicate records from that file. Suppose there 50 records and 5 duplicate records are
deleted then remaining are 45 records, so Trailer record should contain value 45 but it's not getting updated in output
file. Please tell me what sort should I use to update the trailer record as per my requirement.

NOTE - TYPE OF RECORD 2 IS FOR DETAIL AND 3 IS FOR TRAILER.

TYPE-OF-REC EMP-ID EMP-NAME EMP-DEPT
2 21400 SANDIP MECHANICAL
2 21300 MANISH IT
2 21500 TUSHAR COMP
2 21500 TUSHAR COMP
3 04

SORT CARD USING -
SORT FIELDS=(003,005,CH,A,
009,010,CH,A)

SUM FIELDS=NONE

After sorting Triler record will contain value 04, not 3 it should be updated to 3. Please provide me solution for this.

thanks,
Sandip Walsinge
Pune
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: Tue Jul 21, 2009 11:52 am
Reply with quote

Hello,

From what has been posted, i see no reason for the trailer to be modified. . . icon_confused.gif

Possibly, there is something i misunderstand.
Back to top
View user's profile Send private message
sandip_mainframe
Warnings : 2

New User


Joined: 20 Sep 2006
Posts: 63
Location: pune

PostPosted: Tue Jul 21, 2009 12:12 pm
Reply with quote

Hi Dick,
In next step it's matching triler record if it's not matching the job is abending that's the reason we need to update the trailer record count.

Thanks,
Sandip Walsinge
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: Tue Jul 21, 2009 9:30 pm
Reply with quote

Hello,

My reply was not clear. . . .

The posted code does not show any trailer being created/updated.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Jul 21, 2009 10:33 pm
Reply with quote

sandip_mainframe,

Use the following control cards. I assumed that your input is FB and LRECL of 80.

Code:

//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                         
2 21400 SANDIP MECHANICAL                               
2 21300 MANISH IT                                       
2 21500 TUSHAR COMP                                     
2 21500 TUSHAR COMP                                     
3 04                                                   
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                         
  SORT FIELDS=(001,001,CH,A,                           
               003,005,CH,A,                           
               009,010,CH,A)                           
  SUM FIELDS=NONE                                       
  OUTREC IFOUTLEN=80,                                   
  IFTHEN(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,START=0)),   
  IFTHEN=(WHEN=(1,1,ZD,EQ,3),OVERLAY=(3:81,8))         
//*


The output from this job is

Code:

2 21300 MANISH IT           
2 21400 SANDIP MECHANICAL   
2 21500 TUSHAR COMP         
3 00000003                   
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Jul 22, 2009 4:03 am
Reply with quote

Hi Skolusu,

i think this line
Code:
  IFTHEN(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,START=0)),   

should be
Code:
  IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,START=0)),   




Gerry
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 Jul 22, 2009 4:09 am
Reply with quote

Actually, either syntax will work with z/OS DFSORT V1R10, but only the second one will work with z/OS DFSORT V1R5.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Jul 22, 2009 5:29 am
Reply with quote

Thanks Frank


Gerry
Back to top
View user's profile Send private message
sandip_mainframe
Warnings : 2

New User


Joined: 20 Sep 2006
Posts: 63
Location: pune

PostPosted: Wed Jul 22, 2009 6:05 pm
Reply with quote

Thanks for your inputs. I will check this code and if I find any difficulty I will let you know.

Sandip Walsinge
Back to top
View user's profile Send private message
sandip_mainframe
Warnings : 2

New User


Joined: 20 Sep 2006
Posts: 63
Location: pune

PostPosted: Thu Jul 23, 2009 12:02 pm
Reply with quote

Hi Skolusu,
The code given by you is working fine for what I gave in test. But in actual environment my trailer record is comp-3 varilable.

10 BQREBATE-TRAILER-COUNT PIC S9(11) COMP-3.

207/19/20090002413941663200CRX002
FFF6FF6FFFFFFFFFFFFFFFFFFFFCDEFFF
207119120090002413941663200397002
--------------------------------
207/19/20090002885524393200COX123
FFF6FF6FFFFFFFFFFFFFFFFFFFFCDEFFF
207119120090002885524393200367123
--------------------------------
3...ñ.æ
F00043944444444444444444444444444
300390C00000000000000000000000000

Please suggest sort card for this.

Thanks,
Sandip Walsinge
Back to top
View user's profile Send private message
sandip_mainframe
Warnings : 2

New User


Joined: 20 Sep 2006
Posts: 63
Location: pune

PostPosted: Thu Jul 23, 2009 12:05 pm
Reply with quote

Input file format is

RECFM=FB
LRECL=563
BLKSIZE=27587

And Trailer Count start from 2nd column.

Thanks,
Sandip Walsinge
Back to top
View user's profile Send private message
sandip_mainframe
Warnings : 2

New User


Joined: 20 Sep 2006
Posts: 63
Location: pune

PostPosted: Thu Jul 23, 2009 12:30 pm
Reply with quote

Thanks for input I got it.
Back to top
View user's profile Send private message
jebbin

New User


Joined: 13 Nov 2009
Posts: 6
Location: Bangalore

PostPosted: Mon Nov 16, 2009 1:08 pm
Reply with quote

Hi, i tried to use this code for a file i have got. The only problem is that i have got a header record as well, so the count in the trailer is 1 more than it should be. I tried using a criteria which includes only detail records for the seqnum, but then the final overlay is writing spaces to the trailer count field since the seqnum field of the trailer record is empty. i.e

Code:
INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'1'),OVERLAY=(61:SEQNUM,8,ZD,START=0))
           IFTHEN=(WHEN=(1,1,CH,EQ,C'9'),OVERLAY=(10:61,8))
.

The detail records start with a '1' in first field, and the trailer starts with '9'. Header starts with '0'. Here the count will be calulcated correctly. But in the second overlay, since the 61st to 68th positions in the trailer recods is spaces, the count field of the trailer record is re-written with spaces. Any suggestions on how to work around this?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Mon Nov 16, 2009 4:55 pm
Reply with quote

Hi,

try this
Code:
 IFTHEN=(WHEN=INIT,OVERLAY=(61:SEQNUM,8,ZD,START=0)),
 IFTHEN=(WHEN=(1,1,CH,EQ,C'9'),                     
  OVERLAY=(10:61,8,ZD,SUB,+1,EDIT=(TTTTTT)))         


Gerry
Back to top
View user's profile Send private message
jebbin

New User


Joined: 13 Nov 2009
Posts: 6
Location: Bangalore

PostPosted: Mon Nov 16, 2009 5:22 pm
Reply with quote

Hi, i tried that and there is a change, but not expected. My trailer value was coming as:

Code:
99999UTL100006672


72 was the earlier trailer count. So tried increasing the number of 'T's in the EDIT from 6 to 8. I am getting the desired output now. If that is not the way to go about it, please do let me know. Thanks alot for your help.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Nov 17, 2009 12:11 am
Reply with quote

sandip,

Use the following control cards
Code:

//SYSIN    DD *                                                       
  SORT FIELDS=(001,001,CH,A,                                         
               003,005,CH,A,                                         
               009,010,CH,A)                                         
  SUM FIELDS=NONE                                                     

  OUTREC IFOUTLEN=537,                                               
  IFTHEN(WHEN=INIT,OVERLAY=(538:SEQNUM,6,PD)),                       
  IFTHEN=(WHEN=(1,1,ZD,EQ,3),OVERLAY=(2:538,6,PD,SUB,+2,PD,LENGTH=6))
//*


jebbin,

Is your request same as sandip or different?
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: Sat Oct 30, 2010 1:51 am
Reply with quote

With z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026 (Oct,2010), you can now use DFSORT's new IFTRAIL function to do this kind of thing quite easily.

For complete details on the new functions for DFSORT and DFSORT's ICETOOL available with the Oct, 2010 PTF, see:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242
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

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts To get the count of rows for every 1 ... DB2 3
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top