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

Retaining old values in output file


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

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Mon Jul 14, 2008 12:15 pm
Reply with quote

HI,

I want to extract the records from position 5 to 8 in input file and to place that records in position 15 of o/p file. I tried followg code. But it erases the old contents of o/p file from position 1 to 14. I want to retain that contents. How to do that?

Code:

//JSTP0010 EXEC PGM=SORT                     
//SORTIN   DD  DSN=DEV2.RK.TEST(@@CASE),     
//             DISP=SHR                     
//SORTOUT  DD  DSN=DEV2.RK.TEST(@@CASE1),   
//             DISP=SHR                     
//SORTWK01 DD  UNIT=SYSDA,SPACE=(CYL,20)     
//SYSOUT   DD SYSOUT=*                       
//SYSUDUMP DD SYSOUT=*                       
//SYSIN    DD *                             
  SORT FIELDS=COPY                           
  INREC FIELDS=(15:5,3)                     
//*                                         


Input file:

Code:

----+----1-
043800836 
047568288 
047568288 
047568288 
047568288 
047568288 
047568288 
048484353 
048484353 
048484353 


Output file:


Code:

----+----1----+----2
              008   
              682   
              682   
              682   
              682   
              682   
              682   
              843   
              843   
              843   



Regards
R KARTHIK
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Mon Jul 14, 2008 12:18 pm
Reply with quote

karthik,

Use this

Code:
//SYSIN    DD *                             
  SORT FIELDS=COPY                           
  INREC FIELDS=(1,14,15:5,3)                     
//*                     
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Mon Jul 14, 2008 12:30 pm
Reply with quote

Hi Aaru,

I think u wrongly understand my requirement. I did not want the contents from 1,14 of input file.

I will mention u clearly

Before execution

Input file:
Code:

----+----1--
043800836   
047568288   
047568288   
047568288   


Output file:
Code:

----+----1----
R KARTHIKEY
ANBUSELVANR   
KATHIRAVANR
VAIRAVANRAJ

After execution of sort card i want o/p like below

Input file:
Code:

----+----1--
043800836   
047568288   
047568288   
047568288   


Output file:
Code:

----+----1----+----2--
R KARTHIKEY   008
ANBUSELVANR   682   
KATHIRAVANR   682
VAIRAVANRAJ   682
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jul 14, 2008 12:51 pm
Reply with quote

Hello,

Quote:
I think u wrongly understand my requirement. I did not want the contents from 1,14 of input file.
Everyone would wrongly understand your requirement. . . This would be due to the way it was posted. You asked a question about relocating some data (or so it appeared).

Then out of nowhere/somewhere came some output with names - previously unmentioned.

Quote:
I will mention u clearly
When you do, please mention both input files. . . The dsorg and lrecl of the fles and any relevant fields should be mentoned as well as any rules for processing the inputs to get to the output you want.
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Mon Jul 14, 2008 1:13 pm
Reply with quote

Hi dick scherrer,

I understood my mistake. From now i will mention all details.

Here both the files are FB/133.

Regards
R KARTHIK
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: Mon Jul 14, 2008 9:28 pm
Reply with quote

Karthik,

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

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/133)
//IN2 DD DSN=...  input file2 (FB/133)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/133)
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(134,8,ZD) WITH(15,3) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(134:SEQNUM,8,ZD)
/*
//CTL2CNTL DD *
  INREC BUILD=(15:5,3,134:SEQNUM,8,ZD)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,BUILD=(1,133)
/*


IN1 is:

Code:

----+----1--
043800836
047568288
047568288
047568288


IN2 is

Code:

----+----1----+----2--
R KARTHIKEY
ANBUSELVANR
KATHIRAVANR
VAIRAVANRAJ


OUT will be:

Code:

----+----1----+----2--
R KARTHIKEY   008
ANBUSELVANR   682
KATHIRAVANR   682
VAIRAVANRAJ   682
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Tue Jul 15, 2008 11:45 am
Reply with quote

Hi Frank,

It's working now. Thanks for ur help.

Regards
R KARTHIK
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top