MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Updating the trailer record using sort

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
infoman123
Beginner


Joined: 02 Nov 2004
Posts: 57
Topics: 20

PostPosted: Tue Dec 27, 2005 2:31 am    Post subject: Updating the trailer record using sort Reply with quote

Hi,

I have one file like as below

20051227 ==> header record date
11111111111111111111 00000
11111111111111111112 00000
11111111111111111112 00000
11111111111111111113 00000
11111111111111111114 00000
00000005 ==>trailer with count of detail rec

i need to eliminate the duplicates and update the trailer record as below

20051227 ==> header record date
11111111111111111111 00000
11111111111111111112 00000
11111111111111111113 00000
11111111111111111114 00000
00000004 ==>trailer with count of detail rec

Is there any way to acheive this. I was able to create a new trailer record with count 4 by giving the sort card as below.But is there any way to update the orginal trailer record.

Could anyone help me on this.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Dec 27, 2005 10:21 am    Post subject: Reply with quote

Quote:
I was able to create a new trailer record with count 4 by giving the sort card as below.But is there any way to update the orginal trailer record.


What sort card below? Please show it?

What do you mean by "update the original trailer record"? Do you mean update the count, but keep other fields in the trailer record? Or do you mean something else? If the trailer record only has the count, then what's the difference between creating a new trailer record with the count vs updating the original trailer record? You need to explain what you want to do more clearly. A detailed example would help.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
infoman123
Beginner


Joined: 02 Nov 2004
Posts: 57
Topics: 20

PostPosted: Tue Dec 27, 2005 8:20 pm    Post subject: sort card Reply with quote

oops.. sorry to paste it..

Code:

  SORT  FIELDS=(01,20,ZD,A),SKIPREC=1,STOPAFT=00000005 
  SUM FIELDS=NONE                                       
  OUTFIL FNAMES=SORTOUT,REMOVECC,                       
    TRAILER1=(X'FFFF',COUNT=(M11,LENGTH=8))               


this SORT FIELDS=(01,20,ZD,A),SKIPREC=1,STOPAFT=00000005 stop after =005 is sample for this.But i am able to build this.

But this will create only a new trailer records with counts.But i need to update the existing count in the existing trailer record.
Back to top
View user's profile Send private message
infoman123
Beginner


Joined: 02 Nov 2004
Posts: 57
Topics: 20

PostPosted: Tue Dec 27, 2005 8:22 pm    Post subject: Reply with quote

The existing trailer records has some more fields.. that is the reason i need to update the exististing one.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed Dec 28, 2005 8:53 am    Post subject: Reply with quote

Quote:

The existing trailer records has some more fields.. that is the reason i need to update the exististing one.


infoman123,

How do you differentiate the header and trailer records from detail records? Is there a field on these records which identify them? or are they the first and last records of the file?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
infoman123
Beginner


Joined: 02 Nov 2004
Posts: 57
Topics: 20

PostPosted: Wed Dec 28, 2005 9:11 am    Post subject: Reply with quote

the 1st 2bytes of header is low values and trailer is high values.
the detail record is having 1st 2 bytes numeric...
so i need to eliminate the duplicates from detail records and update the trailer with new counts of detail records in the trailer one..

http://www.mvsforums.com/helpboards/viewtopic.php?t=5166&highlight=first+last+skip

i am seprating the header and trailer like said in the link above. and trying to eliminate the duplicates and build a new trailer record with new counts.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed Dec 28, 2005 9:40 am    Post subject: Reply with quote

Quote:

the 1st 2bytes of header is low values and trailer is high values.

infoman123,

can you post the low values and high values along with the dcb properties of the input file. Also post the position and format of the count field to be replaced.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
infoman123
Beginner


Joined: 02 Nov 2004
Posts: 57
Topics: 20

PostPosted: Wed Dec 28, 2005 10:34 am    Post subject: Reply with quote

the position is 3rd byte of the trailer.The low values X'0000' and high values is X'FFFF'. The DCB parameter is VB,rec length is 4504,blk size is 4508.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Dec 28, 2005 11:42 am    Post subject: Reply with quote

infoman123,

Here's a DFSORT job that will do what you asked for. You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's IFTHEN, OVERLAY and COUNT-n functions. Only DFSORT has these functions, so if you don't have DFSORT, you won't be able to use them. If you do have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  VB input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//C1 DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
* Sort
   SORT FIELDS=(5,20,ZD,A)
* Remove duplicates
   SUM FIELDS=NONE
* T1 has header, detail records (w/o dups), trailer
   OUTFIL FNAMES=T1
* C1 has a DFSORT symbol as follows:
* NEWCT,C'nnnnnnnn'
* where nnnnnnnn = count - 2 (-2 for header and trailer)
   OUTFIL FNAMES=C1,REMOVECC,NODETAIL,OUTREC=(80X),VTOF,
     TRAILER1=(C'NEWCT,C''',COUNT-2=(M11,LENGTH=8),C'''')
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&C1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD DSN=...  VB output file
//SYSIN    DD    *
   OPTION COPY
* Overlay original count in trailer with NEWCT
   INREC IFTHEN=(WHEN=(5,2,BI,EQ,X'FFFF'),
                 OVERLAY=(7:NEWCT))
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
infoman123
Beginner


Joined: 02 Nov 2004
Posts: 57
Topics: 20

PostPosted: Wed Dec 28, 2005 12:38 pm    Post subject: Reply with quote

i tried this but i'm getting an error as below after 1st step
ICE218A 0 14 BYTE VARIABLE RECORD IS SHORTER THAN 24 BYTE MINIMUM FOR FIELDS

could you help me
Back to top
View user's profile Send private message
infoman123
Beginner


Joined: 02 Nov 2004
Posts: 57
Topics: 20

PostPosted: Wed Dec 28, 2005 1:09 pm    Post subject: Reply with quote

Frank,
i got the reason of problem mentioned above,it was because headr and trailer are short of the sort filed mentioned.Could you Please suggest any method to over come this and wht i found was the order of header and trailer will change because of the sort field mentioned.How to make header at top itself.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Dec 28, 2005 1:55 pm    Post subject: Reply with quote

Assuming you only have positive numbers for the detail record keys (as shown in your example), replace the SORT statement in the S1 SYSIN with these two statements:

Code:

   OPTION EQUALS,VLSHRT
   SORT FIELDS=(5,20,BI,A)


VLSHRT will take care of the "short" records.

With SORT FIELDS=(5,20,BI,A), the low value in the header record will keep it as the first record and the high value in the trailer record will keep it as the last record.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
infoman123
Beginner


Joined: 02 Nov 2004
Posts: 57
Topics: 20

PostPosted: Wed Dec 28, 2005 8:50 pm    Post subject: Reply with quote

Hi,

I tried the below step which u gave and got a return code of 16 so my shop dont have z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213.
Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
//SORTOUT DD DUMMY
//SYSIN DD *
   OPTION COPY
   INREC OVERLAY=(5:C'A')
/*

We have two mainframes and i was trying this yeterday which we have this installed. So how can we achieve the same result where z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 is not installed.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Dec 29, 2005 11:17 am    Post subject: Reply with quote

This DFSORT job is a bit messier, but I think it will do what you want without using the Dec, 2004 PTF functions:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  VB input file
//T1 DD DISP=MOD,DSN=...  VB output file (MOD)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=(,PASS)
//C1 DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION EQUALS,VLSHRT
  SORT FIELDS=(5,20,BI,A)
  SUM FIELDS=NONE
  OUTFIL FNAMES=T1,OMIT=(5,2,BI,EQ,X'FFFF')
  OUTFIL FNAMES=T2,INCLUDE=(5,2,BI,EQ,X'FFFF')
  OUTFIL FNAMES=C1,REMOVECC,NODETAIL,OUTREC=(80X),VTOF,
    OMIT=(5,2,BI,EQ,X'0000',OR,5,2,BI,EQ,X'FFFF'),
    TRAILER1=(C'NEWCT,C''',COUNT=(M11,LENGTH=8),C'''')
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&C1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T2,DISP=(OLD,PASS)
//SORTOUT DD DISP=MOD,DSN=...  VB output file (MOD)
//SYSIN    DD    *
  OPTION COPY
  INREC FIELDS=(1,6,NEWCT,15)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Oct 27, 2010 4:38 pm    Post subject: Reply with quote

With z/OS DFSORT V1R10 PTF UK90025 or z/OS DFSORT V1R12 PTF UK90026, you can use DFSORT's new IFTRAIL function to do this kind of thing more easily like this:

Code:

//NEW EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  VB input file
//SORTOUT DD DSN=...  VB output file
//SYSIN DD *
  OPTION EQUALS,VLSHRT
  SORT FIELDS=(5,20,BI,A)
  SUM FIELDS=NONE
  OUTFIL IFTRAIL=(HD=YES,TRLID=(5,2,BI,EQ,X'FFFF'),
     TRLUPD=(7:COUNT=(M11,LENGTH=8)))
/*


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
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group