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
 

 

Concatenation based on the header data

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

New User


Joined: 23 Mar 2007
Posts: 35
Location: pune

PostPosted: Wed Apr 07, 2010 5:16 am    Post subject: Concatenation based on the header data
Reply with quote

Hi,

I have a requirement where i need to concatenate data from 2 or more input files and then have a single header record and have maximum date present in the header.
Important points
1. The header is present in the first record of the file
2. The date field is present in posn 23 and has the date format as YYYY-MM-DD
3. The total number of records within the file including the header record is present in the location 40 and is 5 bytes long
4. The record length of both the input files are 50 and FB


Code:
Input file 1
----+----1----+----2----+----3----+----4----+----5
ROSWELL       NM2030512010-02-04       000013     
11111111111111  101120                             
11111111111111  102000                             
11111111111111  104000                             
11111111111111  201090                             
22222222222222  301042                             
22222222222222  101310                             
22222222222222  102000                             
22222222222222  104000                             
22222222222222  102000                             
22222222222222  104000                             
22222222222222  201089                             
22222222222222  301089           

Input File 2
----+----1----+----2----+----3----+----4----+----5
ROSWELL       NM2030512010-02-02       000009   
44444444444444  101120                           
44444444444444  102000                           
44444444444444  104000                           
44444444444444  201090                           
33333333333333  301042                           
33333333333333  101310                           
33333333333333  102000                           
33333333333333  104000                     


Output file
----+----1----+----2----+----3----+----4----+----5
ROSWELL       NM2030512010-02-04       000021
11111111111111  101120                       
11111111111111  102000                       
11111111111111  104000                       
11111111111111  201090                       
22222222222222  301042                       
22222222222222  101310                       
22222222222222  102000                       
22222222222222  104000                       
22222222222222  102000                       
22222222222222  104000                       
22222222222222  201089                       
22222222222222  301089                       
44444444444444  101120                       
44444444444444  102000                       
44444444444444  104000                       
44444444444444  201090                       
33333333333333  301042                       
33333333333333  101310                       
33333333333333  102000                       
33333333333333  104000                           

Any help would be great
Back to top
View user's profile Send private message

Escapa

Senior Member


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

PostPosted: Wed Apr 07, 2010 10:34 am    Post subject:
Reply with quote

Does "ROSWELL" identifies Header record?
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: Wed Apr 07, 2010 7:06 pm    Post subject:
Reply with quote

Hello,

No (at least i don't believe so).

Being the first record identifies the header.
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 Apr 07, 2010 9:43 pm    Post subject:
Reply with quote

ts,

A better question - is there anything in the header record that identifies it (e.g. non-blank in position 15, or non-blank in position 40, or ?)?

Quote:
i need to concatenate data from 2 or more input files


What is the maximum number of input files you would have?

Are you looking for a general solution that does NOT require any changes for different numbers of files? Or can you change the job depending on the number of files?
Back to top
View user's profile Send private message
thunderstorm

New User


Joined: 23 Mar 2007
Posts: 35
Location: pune

PostPosted: Wed Apr 07, 2010 10:42 pm    Post subject:
Reply with quote

Hi Frank,
The header portion till posn 22 is always constant.
ROSWELL NM203051

We can have a maximum of 3 files and that might increase as well.
So , to answer your question i am expecting a general solution that does not require any changes for any number of files.
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 Apr 07, 2010 11:28 pm    Post subject:
Reply with quote

Ok, first a couple of corrections:

For the output, you show the count as 21, but it should be 22 (13+9) ... right?

You say the count is 5 bytes long, but you show it in 40-45 which is 6 bytes.

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//CON DD DSN=...  input file1 (FB/50)
//    DD DSN=...  input file2 (FB/50)
//    ...
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/50)
//TOOLIN DD *
SORT FROM(CON) TO(T1) USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(51:SEQNUM,8,ZD)),
    IFTHEN=(WHEN=(1,7,CH,EQ,C'ROSWELL'),OVERLAY=(51:8C'0'))
  SORT FIELDS=(51,8,ZD,A,23,10,CH,D)
/*
//CTL2CNTL DD *
  OPTION EQUALS
  SORT FIELDS=(51,8,ZD,A)
  SUM FIELDS=(40,6,ZD)
  OUTREC BUILD=(1,50)
/*
Back to top
View user's profile Send private message
thunderstorm

New User


Joined: 23 Mar 2007
Posts: 35
Location: pune

PostPosted: Thu Apr 08, 2010 1:17 am    Post subject:
Reply with quote

Yes Frank , it was a calculation error on my part.
I ran the job but in the count section i am getting
000000002B instead of 0000000022
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: Thu Apr 08, 2010 1:30 am    Post subject:
Reply with quote

ts,

You could be using DFSORT with ZDPRINT=NO in effect.

Try changing the OPTION statement in CTL2CNTL to:

Code:

  OPTION EQUALS,ZDPRINT
Back to top
View user's profile Send private message
thunderstorm

New User


Joined: 23 Mar 2007
Posts: 35
Location: pune

PostPosted: Thu Apr 08, 2010 3:32 am    Post subject:
Reply with quote

Thanks frank ..it worked
Back to top
View user's profile Send private message
thunderstorm

New User


Joined: 23 Mar 2007
Posts: 35
Location: pune

PostPosted: Thu Apr 08, 2010 4:52 am    Post subject:
Reply with quote

Frank - I take back my words..The header count should be 21 and not 22 because in the final file i want only 1 header with the correct count.
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: Thu Apr 08, 2010 6:07 am    Post subject:
Reply with quote

Ok, then use this DFSORT/ICETOOL job:

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//CON DD DSN=...  input file1 (FB/50)
//    DD DSN=...  input file2 (FB/50)
//    ...
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/50)
//TOOLIN DD *
SORT FROM(CON) TO(T1) USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(51:SEQNUM,8,ZD,59:8C'0')),
    IFTHEN=(WHEN=(1,7,CH,EQ,C'ROSWELL'),
      OVERLAY=(51:8C'0',59:C'00000001'))
  SORT FIELDS=(51,8,ZD,A,23,10,CH,D)
/*
//CTL2CNTL DD *
  OPTION EQUALS
  SORT FIELDS=(51,8,ZD,A)
  SUM FIELDS=(40,6,ZD,59,8,ZD)
  OUTREC IFOUTLEN=50,
    IFTHEN=(WHEN=(1,7,CH,EQ,C'ROSWELL'),
     OVERLAY=(40:40,6,ZD,SUB,59,8,ZD,ADD,+1,TO=ZD,LENGTH=6))
/*
Back to top
View user's profile Send private message
thunderstorm

New User


Joined: 23 Mar 2007
Posts: 35
Location: pune

PostPosted: Thu Apr 08, 2010 6:50 am    Post subject:
Reply with quote

Thanks Frank..This is perfect
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 Is the 'prompt' data for the DSLIST p... Willy Jensen TSO/ISPF 2 Tue Dec 06, 2016 4:38 am
No new posts How to move a long alphanumeric data ... lind sh COBOL Programming 6 Mon Dec 05, 2016 7:51 pm
No new posts ODPP(Optim Data privacy Provider) Iss... Rama kishore IBM Tools 1 Mon Nov 07, 2016 5:46 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm


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