Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

JCL SORT CARD to update the trailer record count

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
sandip_mainframe
Warnings : 2

New User


Joined: 20 Sep 2006
Posts: 61
Location: pune

PostPosted: Tue Jul 21, 2009 11:48 am    Post subject: JCL SORT CARD to update the trailer record count
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

Site Director


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

PostPosted: Tue Jul 21, 2009 11:52 am    Post subject:
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: 61
Location: pune

PostPosted: Tue Jul 21, 2009 12:12 pm    Post subject:
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

Site Director


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

PostPosted: Tue Jul 21, 2009 9:30 pm    Post subject:
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    Post subject:
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: 1703
Location: Australia

PostPosted: Wed Jul 22, 2009 4:03 am    Post subject:
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 Moderator


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

PostPosted: Wed Jul 22, 2009 4:09 am    Post subject:
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: 1703
Location: Australia

PostPosted: Wed Jul 22, 2009 5:29 am    Post subject:
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: 61
Location: pune

PostPosted: Wed Jul 22, 2009 6:05 pm    Post subject:
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: 61
Location: pune

PostPosted: Thu Jul 23, 2009 12:02 pm    Post subject:
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: 61
Location: pune

PostPosted: Thu Jul 23, 2009 12:05 pm    Post subject:
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: 61
Location: pune

PostPosted: Thu Jul 23, 2009 12:30 pm    Post subject:
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    Post subject: Reply to: JCL SORT CARD to update the trailer record count
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: 1703
Location: Australia

PostPosted: Mon Nov 16, 2009 4:55 pm    Post subject:
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    Post subject: Reply to: JCL SORT CARD to update the trailer record count
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    Post subject: Reply to: JCL SORT CARD to update the trailer record count
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 Moderator


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

PostPosted: Sat Oct 30, 2010 1:51 am    Post subject:
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:

http://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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us