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

Sum up the values in trailer rec for variable length file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ranjithmainframe

New User


Joined: 21 Jan 2008
Posts: 39
Location: chennai

PostPosted: Fri Sep 26, 2008 12:21 am
Reply with quote

Hi,

Can anyone throw some light on my below request,

I have two VB input files contains details and trailer (both are in different format) as follows, (the files are tab delimited )

file1

Code:
,,Command ===>,                                           
----+----1----+----2----+----3----+----4----+----5----+---
********************************* Top of Data ************
153.6879450212001019212.08112008.29100.1DNBWIRE
153.6879450212001019212.09042008.15923.1DNBWIRE
153.6879450204008307195.08262008.15000.1DNBWIRE
153.6879450212002099932.09122008.146171.1DNBWIRE
153.6879450212001291167.08282008.25000.1DNBWIRE
153.6879450204010156044.08282008.70000.1DNBWIRE
153.6879450204001959489.09082008.367999.1DNBWIRE
TRAILER.7.669193...7.669193
******************************** Bottom of Data **********


file2

Code:

,Command ===>,                                           
----+----1----+----2----+----3----+----4----+----5----+---
********************************* Top of Data ************
155.6879450212001019212.08112008.29101.1DNBWIRE
155.6879450212001019212.09042008.15924.1DNBWIRE
155.6879450204008307195.08262008.15001.1DNBWIRE
155.6879450212002099932.09122008.146181.1DNBWIRE
155.6879450212001291167.08282008.25001.1DNBWIRE
155.6879450204010156044.08282008.70001.1DNBWIRE
155.6879450204001959489.09082008.368000.1DNBWIRE
TRAILER.7.669200...7.669200
******************************** Bottom of Data **********


I need to concatenate the details (not starts with word "trailer" in first column) with sorted from 4th column to 19 length and count the trailer values and write the final trailer record as follows at the end of the concatenated details. For example, the trailer should as follows,

TRAILER.14.1338393...14.1338393

There is no common values between files and both are tab delimited files.
I am trying to do this with sort.

Can anyone suggest a way to approach this,

Thanks,
Ranjith
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: Fri Sep 26, 2008 1:19 am
Reply with quote

You need to do a better job of describing the layout of the trailer records. You show 'TRAILER' followed by a dot, a field, a dot, a field, 3 dots, a field, a dot and a field. What does the trailer record actually look like in hex. How do we find the fields you want to add? What should the output trailer look like in hex? Do you have/want a tab between each field? Does each dot represent a tab character? If so, why are there three dots after the third field in the trailer? Does that represent three tab characters?

What is the LRECL of the input file?

Show the expected output records for your example input records.
Back to top
View user's profile Send private message
ranjithmainframe

New User


Joined: 21 Jan 2008
Posts: 39
Location: chennai

PostPosted: Fri Sep 26, 2008 1:48 pm
Reply with quote

Frank,

Each dot represents TAB - hex value is X'05'. Three dots represent three continuous tabs. File is variable length file and maximum length is 60 bytes. Here's my expected output,


Code:

----+----1----+----2----+----3----+----4----+----5----+---
********************************* Top of Data ************
153.6879450212001019212.08112008.29100.1DNBWIRE
153.6879450204001959489.09082008.367999.1DNBWIRE 
153.6879450204008307195.08262008.15000.1DNBWIRE   
153.6879450204010156044.08282008.70000.1DNBWIRE   
153.6879450212001019212.09042008.15923.1DNBWIRE   
153.6879450212001291167.08282008.25000.1DNBWIRE   
153.6879450212002099932.09122008.146171.1DNBWIRE 
155.6879450204001959489.09082008.368000.1DNBWIRE 
155.6879450204008307195.08262008.15001.1DNBWIRE   
155.6879450204010156044.08282008.70001.1DNBWIRE   
155.6879450212001019212.08112008.29101.1DNBWIRE   
155.6879450212001019212.09042008.15924.1DNBWIRE   
155.6879450212001291167.08282008.25001.1DNBWIRE   
155.6879450212002099932.09122008.146181.1DNBWIRE 
TRAILER.14.1338393...14.1338393


Sorted from column 1 to 23.


Thanks,
Ranjith
[/code]
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Fri Sep 26, 2008 3:33 pm
Reply with quote

Here is the jcl for you..
Code:

//IN1 DD *                                       
153.6879450212001019212.08112008.29100.1DNBWIRE 
153.6879450212001019212.09042008.15923.1DNBWIRE 
153.6879450204008307195.08262008.15000.1DNBWIRE 
153.6879450212002099932.09122008.146171.1DNBWIRE
153.6879450212001291167.08282008.25000.1DNBWIRE 
153.6879450204010156044.08282008.70000.1DNBWIRE 
153.6879450204001959489.09082008.367999.1DNBWIRE
TRAILER.7.669193...7.669193                     
/*                                               
//    DD *                                       
155.6879450212001019212.08112008.29101.1DNBWIRE 
155.6879450212001019212.09042008.15924.1DNBWIRE 
155.6879450204008307195.08262008.15001.1DNBWIRE 
155.6879450212002099932.09122008.146181.1DNBWIRE
155.6879450212001291167.08282008.25001.1DNBWIRE
155.6879450204010156044.08282008.70001.1DNBWIRE
155.6879450204001959489.09082008.368000.1DNBWIRE
TRAILER.7.669200...7.669200                     
/*                                             
//OUT1 DD  SYSOUT=*                             
//TOOLIN   DD    *                             
  COPY FROM(IN1) TO(TMP) USING(CTL1)           
  COPY FROM(TMP1) TO(TMP2) USING(CTL2)         
  COPY FROM(TMP2) TO(TMP) USING(CTL3)           
  COPY FROM(TMP) TO(OUT1)                       
/*                                             
//TMP  DD  DSN=&&TEMP,DISP=(MOD,PASS)           
//TMP1 DD  DSN=&&TEMP2,DISP=(NEW,PASS)         
//TMP2 DD  DSN=&&TEMP3,DISP=(NEW,PASS)         
//CTL1CNTL DD *                                 
  SORT FIELDS=(1,23,CH,A)                                         
  OUTFIL FNAMES=TMP,OMIT=(1,7,CH,EQ,C'TRAILER')                   
  OUTFIL FNAMES=TMP1,INCLUDE=(1,7,CH,EQ,C'TRAILER')               
/*                                                                 
//CTL2CNTL DD *                                                   
  SORT FIELDS=COPY                                                 
  INREC  PARSE=(%00=(ABSPOS=9,FIXLEN=2,ENDBEFR=C'.'),             
              %01=(FIXLEN=7,ENDBEFR=C'...'),                       
              %02=(FIXLEN=2,ENDBEFR=C'.'),                         
              %03=(FIXLEN=7)),                                     
       BUILD=(1,8,%00,UFF,EDIT=(TT),11:C'.',%01,UFF,EDIT=(TTTTTTT),
              C'...',%02,UFF,EDIT=(TT),C'.',%03,UFF,EDIT=(TTTTTTT))
/*                                                                 
//CTL3CNTL DD *                                                   
  SORT FIELDS=(1,8,CH,A)                                           
  SUM FIELDS=(9,2,ZD,12,7,ZD,22,2,ZD,25,7,ZD)                     
/*

Output will be
Code:

153.6879450204001959489.09082008.367999.1DNBWIRE
153.6879450204008307195.08262008.15000.1DNBWIRE
153.6879450204010156044.08282008.70000.1DNBWIRE
153.6879450212001019212.08112008.29100.1DNBWIRE
153.6879450212001019212.09042008.15923.1DNBWIRE
153.6879450212001291167.08282008.25000.1DNBWIRE
153.6879450212002099932.09122008.146171.1DNBWIRE
155.6879450204001959489.09082008.368000.1DNBWIRE
155.6879450204008307195.08262008.15001.1DNBWIRE
155.6879450204010156044.08282008.70001.1DNBWIRE
155.6879450212001019212.08112008.29101.1DNBWIRE
155.6879450212001019212.09042008.15924.1DNBWIRE
155.6879450212001291167.08282008.25001.1DNBWIRE
155.6879450212002099932.09122008.146181.1DNBWIRE
TRAILER.14.1338393...14.1338393                 
Back to top
View user's profile Send private message
ranjithmainframe

New User


Joined: 21 Jan 2008
Posts: 39
Location: chennai

PostPosted: Fri Sep 26, 2008 3:43 pm
Reply with quote

Sambhaj,

Thanks For your reply...

I would have mentioned my sort version in my post initially. I have only SYNCSORT FOR Z/OS 1.2.3 which doesn't support parse function. As a final try, I need to request to install latest verision may be SyNCSORT 1.3.

Thanks for your inputs.

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

Senior Member


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

PostPosted: Sun Sep 28, 2008 4:36 pm
Reply with quote

Quote:
As a final try, I need to request to install latest verision may be SyNCSORT 1.3.


Well that you can do always for future..
but for now if you have control over generating input files then you can sort this issue for now.
Code:

153.6879450204001959489.09082008.367999.1DNBWIRE
TRAILER.7.669193...7.669193


if instead of writing 7 if that number can be upto 99 in output then you can write it as
(similarly for all fields you want to sum)

Code:

153.6879450204001959489.09082008.367999.1DNBWIRE
TRAILER.07.0669193...07.0669193



so that there is no need of parsing we will have to do sum fields from fixed lenghts.
this is assumed when there is no data in ... (three dots).
If there is possibility of data in specified position then you can shift fields you want to sum at left and fields shown(If agreed by users) .... towards extreme end.
as below..
Code:

153.6879450204001959489.09082008.367999.1DNBWIRE
TRAILER.07.0669193.07.0669193..

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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 0
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
Search our Forums:

Back to Top