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

Add file1 value to file2 variable


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Dec 05, 2006 7:45 pm
Reply with quote

Hi,

I have two flat files as below -

file1 (lrecl=6 bytes):
77 constant pic 9(6)

file2 details (lrecl=601 bytes):
Layout-
01 group
03 some_data (595 bytes in lenght)
03 numvar pic 9(6)

File1 always has ONE record. Whereas number of records in File2 varies from run to run.

My requirement is to add the file1 value to NUMVAR of file2. For ex -

file1-
000145

file2-
------------------------
somedata numvar
-------------------------
1record 000001
2record 000005
3record 000018

The resultant file should be -
1record 000146 ----> where 000146 = 000001+000145
2record 000150
3record 000163


At present we are using COBOL program for this purpose. As SORT is more efficient over COBOL, we decided to switch over. Please help me in resolving this.

Regards,
Mohan
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: Tue Dec 05, 2006 9:44 pm
Reply with quote

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

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file1 (FB/6)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
* Create DFSORT Symbol as follows with nnnnnn from file1
* Con1,+nnnnnn
  INREC BUILD=(C'Con1,+',1,6,80:X)
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  input file2 (FB/601)
//SORTOUT DD DSN=...  output file (FB/601)
//SYSIN    DD    *
  OPTION COPY
* Add Con1 to numvar in each file2 record.
  INREC OVERLAY=(596:596,6,ZD,ADD,Con1,TO=ZD,LENGTH=6)
/*
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Wed Dec 06, 2006 8:02 am
Reply with quote

Thanks Franks for the resolution.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Wed Dec 06, 2006 8:14 am
Reply with quote

Very sorry Frank about the name in my earlier post.
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: Wed Dec 06, 2006 10:13 pm
Reply with quote

Quote:
Very sorry Frank about the name in my earlier post.


No problem. I've been called lots worse than "Franks". icon_lol.gif
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Thu Dec 07, 2006 1:10 am
Reply with quote

...tell us , are they printable?
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: Thu Dec 07, 2006 2:20 am
Reply with quote

Some of them. icon_wink.gif
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
No new posts Masking variable size field - min 10 ... DFSORT/ICETOOL 4
Search our Forums:

Back to Top