View previous topic :: View next topic
Author
Message
vpr_118 Warnings : 1 New User Joined: 07 Apr 2008Posts: 64 Location: chennai
Hi,
Please find the requirment below.
I have a file as below
1< some data >...YYMMDD...<some data>
5<............some data.................> ...YYMMDD
Now i have to change the YYMMDD in record starting with 5 must be same as YYMMDD of record starting from 1.
Say YYMMDD is 080722 for record starting with 1
same must be in record starting with 5
For record 1 YYMMDD starts at 24th position
and for record 5 it starts at 70 th position
The file is of lrecl=94
Can it be done using sort
Back to top
expat Global Moderator Joined: 14 Mar 2007Posts: 8797 Location: Welsh Wales
Which sort product are you using ?
DFSORT or SYNCSORT or even CA-SORT
Back to top
vpr_118 Warnings : 1 New User Joined: 07 Apr 2008Posts: 64 Location: chennai
I am using DFSORT.
Please let me know if we can get a data from a particular record starting with '1' and place it to another record starting with 5 from particular position.
Back to top
Aaru Senior Member Joined: 03 Jul 2007Posts: 1287 Location: Chennai, India
VPR,
Check this JCl for your reqt
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1ABCDEFGHIJKLMNOPQRSTUV080722ABCDEF
5AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYYMMDD
/*
//SORTOUT DD DSN=&&W2,DISP=(,PASS),
// SPACE=(TRK,(1,1)),UNIT=SYSDA
//SYSIN DD *
OPTION COPY,STOPAFT=1
* CREATE DFSORT SYMBOL AS:
* MYDATE,'YYMMDD'
OUTREC FIELDS=(C'TESTDT,''',24,6,C'''',80:X)
/*
//*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&W2,DISP=(OLD,PASS)
//SORTIN DD *
1ABCDEFGHIJKLMNOPQRSTUV080722ABCDEF
5AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYYMMDD
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
* USE TESTDT TO OVERLAY OLD DATE.
INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'5'),
OVERLAY=(50:TESTDT))
/*
Output:
Code:
1ABCDEFGHIJKLMNOPQRSTUV080722ABCDEF
5AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA080722
Change 50 to 70 and test. I have assumed the position as 50 for my testting.
Back to top
vpr_118 Warnings : 1 New User Joined: 07 Apr 2008Posts: 64 Location: chennai
Thanks for your reply.
Can it be done using PGM=SORT.
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Quote:
Can it be done using PGM=SORT
Yes
Thanks,
Arun
Back to top
Aaru Senior Member Joined: 03 Jul 2007Posts: 1287 Location: Chennai, India
Vpr,
Quote:
Thanks for your reply. Can it be done using PGM=SORT.
Yes.
DFSORT can be invoked directly either by using PGM=SORT or PGM=ICEMAN.
Change, test and let us know if it works.
Back to top
vpr_118 Warnings : 1 New User Joined: 07 Apr 2008Posts: 64 Location: chennai
I did a test run using the jcl given by you. It ended with S013.
Code:
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN DD DSN=<INPUT FILE>,DISP=SHR
//SORTOUT DD DSN=&&TEMP,
// SPACE=(CYL,(1,1),RLSE),
// DISP=(NEW,PASS)
//SYSIN DD *
OPTION COPY,STOPAFT=1
OUTREC FIELDS=(C'TESTDT,''',24,6,C'''',94:X)
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&TEMP,DISP=(OLD,PASS)
//SORTIN DD DSN=<INPUT FILE>,DISP=SHR
//SORTOUT DD DSN=<OUTPUT FILE>,
// DISP=(NEW,CATLG,DELETE),
// DCB=D04BT.ECSUS.SYMP3.BPC10508.WEBRTURN,
// SPACE=(CYL,(25,25),RLSE)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'5'),
OVERLAY=(70:TESTDT))
/*
S013:
Code:
ICE751I 2 C5-K26318 DA-K28804
ICE185A 0 AN S013 ABEND WAS ISSUED BY DFSORT, ANOTHER PROGRAM OR AN EXIT (PHASE 0)
Back to top
vpr_118 Warnings : 1 New User Joined: 07 Apr 2008Posts: 64 Location: chennai
Thanks Aru,
I got the culprit.
I am able to run the job using PGM=SORT.
Please find the job below
Code:
//****************************************************
//* JCL INSERT A FIELD IN A PARTICULAR POSITION*******
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN DD DSN=<...INPUT FILE...>,DISP=SHR
//SORTOUT DD DSN=&&TEMP,
// SPACE=(CYL,(1,1),RLSE),
// DISP=(NEW,PASS)
//SYSIN DD *
OPTION COPY,STOPAFT=1
OUTREC FIELDS=(C'TESTDT,''',24,6,C'''',80:X)
/*
//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&TEMP,DISP=(OLD,PASS)
//SORTIN DD DSN=<...INPUT FILE...>,DISP=SHR
//SORTOUT DD DSN=<...OUTPUT FILE...>,
// DISP=(NEW,CATLG,DELETE),
// DCB=<...INPUT FILE....>,
// SPACE=(CYL,(25,25),RLSE)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'5'),
OVERLAY=(70:9,6))
/*
Can it be done in a single step.
Back to top
Aaru Senior Member Joined: 03 Jul 2007Posts: 1287 Location: Chennai, India
Vpr,
Quote:
I did a test run using the jcl given by you. It ended with S013.
It is because of the below statement in your JCL.
Code:
OUTREC FIELDS=(C'TESTDT,''',24,6,C'''',94:X)
From where did you get 94 when i had mentioned 80 in my JCL?? SYMNAMES dataset record length should be 80. Change it to 80 and check, it would work.
Quote:
Can it be done in a single step.
As far as i know, it is difficult to do this in one step. Wait for Frank for a better solution in a single step.
Please use the code tag while posting the code. Check this
http://ibmmainframes.com/faq.php?mode=bbcode
Moderators,
Please move this topic to the DFSORT forum.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Vpr,
The job Aaru gave you only reads one record in the first step so what's the problem with using two steps?
However, if you have z/OS DFSORT V1R5 PTF UK90013 (July, 2008), you can use the new WHEN=GROUP function to do this in one pass. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.
Code:
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/80)
//SORTOUT DD DSN=... output file (FB/80)
//SYSIN DD *
OPTION COPY
INREC IFOUTLEN=80,
IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'1'),PUSH=(81:24,6)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'5'),OVERLAY=(70:81,6))
/*
For complete details on the new WHEN=GROUP function and the other new functions available with PTF UK90013, see:
Use [URL] BBCode for External Links
Back to top
vpr_118 Warnings : 1 New User Joined: 07 Apr 2008Posts: 64 Location: chennai
The link is really very informative.
Why i need to do it one step?
Aim is to reduce the number of steps and there by number of lines in jcl as far as possible.
The jcl give by you also worked.
Back to top
Aaru Senior Member Joined: 03 Jul 2007Posts: 1287 Location: Chennai, India
Vpr,
Quote:
Why i need to do it one step?
You should only answer.
Hope you finally got what you wanted.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Quote:
Aim is to reduce the number of steps and there by number of lines in jcl as far as possible.
Hmmm ... I can't imagine why a few extra lines of JCL would matter in any significant way, but ok. (You must have some "extreme" beancounters in your shop.)
Quote:
The jcl give by you also worked.
Good.
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19244 Location: Inside the Matrix
Hello,
Quote:
Aim is to reduce the number of steps and there by number of lines in jcl as far as possible.
Why?
What business or technical reason might there be for this?
It is far better to implement processes that run correctly, use minimum system resources, and are easily understood and maintained. To sacrifice any of those requirements to save a few lines of jcl or another step does the system and the organization a great disservice.
Back to top
vpr_118 Warnings : 1 New User Joined: 07 Apr 2008Posts: 64 Location: chennai
Hi,
Suggestions and advice well taken.
Will make sure to keep all these in mind and implement the same.
Thanks all..
Back to top
Please enable JavaScript!