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
 

 

Add file1 value to file2 variable

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

Senior Member


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

PostPosted: Tue Dec 05, 2006 7:45 pm    Post subject: Add file1 value to file2 variable
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 Moderator


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

PostPosted: Tue Dec 05, 2006 9:44 pm    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Wed Dec 06, 2006 8:02 am    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Wed Dec 06, 2006 8:14 am    Post subject:
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 Moderator


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

PostPosted: Wed Dec 06, 2006 10:13 pm    Post subject:
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    Post subject: Re: Add file1 value to file2 variable
Reply with quote

...tell us , are they printable?
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 Dec 07, 2006 2:20 am    Post subject:
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    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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm


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