View previous topic :: View next topic
|
Author |
Message |
karthikr44
Active User
Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
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 |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
karthik,
Use this
Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC FIELDS=(1,14,15:5,3)
//* |
|
|
Back to top |
|
|
karthikr44
Active User
Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
karthikr44
Active User
Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
karthikr44
Active User
Joined: 25 Aug 2007 Posts: 235 Location: Chennai
|
|
|
|
Hi Frank,
It's working now. Thanks for ur help.
Regards
R KARTHIK |
|
Back to top |
|
|
|