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
 

 

Sum up the values in trailer rec for variable length file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Sum up the values in trailer rec for variable length file
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 Moderator


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

PostPosted: Fri Sep 26, 2008 1:19 am    Post subject:
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    Post subject: Reply to: Sum up the values in trailer rec for variable leng
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    Post subject:
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    Post subject: Reply to: Sum up the values in trailer rec for variable leng
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am


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