Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
query on the TRAILER1 function

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

New User


Joined: 31 Aug 2010
Posts: 20
Location: Edinburgh

PostPosted: Wed Feb 01, 2012 9:11 pm    Post subject: query on the TRAILER1 function
Reply with quote

Hi,

I'm trying to copy a file and rebuild the trailer record.

I want to add some fixed text, copy position 22 for 8 from the original trailer and recalculate the count and total on a specific column. Here's what I have so far.

Code:
OMIT COND=((01,007,EQ,C'T######')),FORMAT=CH                 
SORT FIELDS=COPY                                             
                                                             
OUTFIL REMOVECC,                                             
TRAILER1=('T######',                                         
          &DATENS=(4MD),                                     
          &TIMENS=(24),                                       
          22,8,                                               
          'NG',                                               
          'ASSETFIN',                                         
          COUNT=(M11,LENGTH=08),                             
          TOT=(10,02,ZD,M11,LENGTH=20))   


In the above example the
Code:
22,8
just creates 8 spaces because I do not know how to tell it to pick these chars up from the original trailer, especially as I am omitting the original trailer.

I have tried to use the BUILD function but it does not appear to allow the COUNT and TOT functions.

Does anyone know how to rebuild a trailer record with TOT and COUNT while also picking up some info from the original trailer ?

Many thanks.
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 Feb 01, 2012 11:59 pm    Post subject:
Reply with quote

You need to give more details before I can help you.

Please show an example of the records in your input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input file.
Back to top
View user's profile Send private message
Yvonne1980

New User


Joined: 31 Aug 2010
Posts: 20
Location: Edinburgh

PostPosted: Thu Feb 02, 2012 2:29 pm    Post subject: Reply to: query on the TRAILER1 function
Reply with quote

Here's a little made up input and output file, both files will be VB 5004. A trailer is identified by 01,007,EQ,C'T######' the column to be totalled is TOT=(10,02,ZD,M11,LENGTH=20), the field I want to pick up from the original trailer is char data starting in pos 22 for 8

Input
Code:
AG060000021                             
AG130000011                             
AG130000011                             
AG140000051                             
AG140000051                             
A9660000011                             
A9660000011                             
T######20110928235827STRINGXY


Output
Code:
AG060000021                                                                   
AG130000011                                                                   
AG130000011                                                                   
AG140000051                                                                   
AG140000051                                                                   
A9660000011                                                                   
A9660000011                                                                   
T######20120201161732STRINGXYNGASSETFIN0000000800000000000000000167


New Trailer
1. char string 'T#######'
2. Date: YYYYMMDD
3. Time: HHMMSS
4. 8 chars from original trailer in char format starting in pos 22 for 8.
5. Char string: 'NG',
6. Char string: 'ASSETFIN',
7. Record count: COUNT=(M11,LENGTH=08),
8. The sum of col 10 for 2 TOT=(10,02,ZD,M11,LENGTH=20)
Back to top
View user's profile Send private message
Yvonne1980

New User


Joined: 31 Aug 2010
Posts: 20
Location: Edinburgh

PostPosted: Thu Feb 02, 2012 4:41 pm    Post subject: Reply to: query on the TRAILER1 function
Reply with quote

Hi Frank,

I have updated the above post:

Here's a little made up input and output file, both files will be VB 5004. A trailer is identified by 01,007,EQ,C'T######' the column to be totalled is TOT=(10,02,ZD,M11,LENGTH=20), the field I want to pick up from the original trailer is char data starting in pos 22 for 8

Input
Code:
AG060000021                             
AG130000011                             
AG130000011                             
AG140000051                             
AG140000051                             
A9660000011                             
A9660000011                             
T######20110928235827STRINGXY


Output
Code:
AG060000021                                                                   
AG130000011                                                                   
AG130000011                                                                   
AG140000051                                                                   
AG140000051                                                                   
A9660000011                                                                   
A9660000011                                                                   
T######20120201161732STRINGXYNGASSETFIN0000000700000000000000000167


New Trailer layout
1. char string 'T#######'
2. Sys Date: YYYYMMDD
3. Sys Time: HHMMSS
4. 8 chars from original trailer in char format starting in pos 22 for 8.
5. Char string: 'NG',
6. Char string: 'ASSETFIN',
7. Next 8 bytes contains the Record count: COUNT=(M11,LENGTH=08),
8. Next 20 bytes contains The sum of col 10 for 2 TOT=(10,02,ZD,M11,LENGTH=20)

Thanks 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: Thu Feb 02, 2012 10:26 pm    Post subject: Reply to: query on the TRAILER1 function
Reply with quote

Yvonne1980,

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 update the trailer record like shown below


Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD DSN=Your input VB 5004 byte file,
//            DISP=SHR                         
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                       
  OUTREC IFTHEN=(WHEN=(5,7,CH,EQ,C'T######'),           
  OVERLAY=(12:DATE1,TIME1,34:C'NGASSETFIN',28X))         
                                                         
  OUTFIL IFTRAIL=(TRLID=(5,7,CH,EQ,C'T######'),         
  TRLUPD=(44:COUNT=(M11,LENGTH=08),                     
             TOT=(14,2,ZD,EDIT=(TTTTTTTTTTTTTTTTTTTT))))
//*


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
Yvonne1980

New User


Joined: 31 Aug 2010
Posts: 20
Location: Edinburgh

PostPosted: Fri Feb 03, 2012 2:47 pm    Post subject: Reply to: query on the TRAILER1 function
Reply with quote

Hi Kolusu,

IFTRAIL, didn't know about that one.

Thanks for that wonderful piece of knowledge sharing.
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 HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
No new posts What is the Extract Function in JCL dharmaraok JCL & VSAM 3 Wed Jun 14, 2017 9:12 am
No new posts Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us