Write a JCL by using the below requirement:
File1 =1, File2 =11 and output needs to come as File3 =111?
Answers were Sorted based on User's Feedback
Answer / mdv
Step 1.
Add SEQNUM for both the files @ positions 3 to 8 and 2 to 7
respectively.
Step 2.
Join based on key and reformat as needed.
// SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(3,6,A)
JOINKEYS FILE=F2,FIELDS=(2,6,A)
REFORMAT FIELDS=(F1:1,2,F2:1,1)
SORT FIELDS=COPY
/*
Note: Not tested.
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / sathish kumar chandra sekaran
//D362967J JOB (UBS-UBS-D362967-XXX-999),CLASS=C,
// MSGCLASS=X,MSGLEVEL=(1,1),NOTIFY=D362967
//STEP1 EXEC PGM=SORT
//SORTIN DD *
1
/*
//SORTOUT DD DSN=D362967.TEST.PS3,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,8,60:SEQNUM,3,ZD,START=1,INCR=2)
/*
//STEP2 EXEC PGM=SORT
//SORTIN DD *
11
/*
//SORTOUT DD DSN=D362967.TEST.PS4,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1:C'1',2:1,8,60:SEQNUM,3,ZD,START=2,INCR=2)
/*
//STEP3 EXEC PGM=SORT
//SORTIN DD DSN=D362967.TEST.PS3,DISP=SHR
// DD DSN=D362967.TEST.PS4,DISP=SHR
//SORTOUT DD DSN=D362967.TEST.PS5,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(60,3,CH,A)
/*
//STEP4 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=D362967.TEST.PS5,DISP=SHR
//OUT1 DD SYSOUT=*
//TOOLIN DD *
SPLICE FROM(IN1) TO(OUT1)-
ON(1,1,CH) KEEPNODUPS WITH(2,2)
/*
This will meet your requirement.
Is This Answer Correct ? | 3 Yes | 2 No |
Answer / nishant singhal
we can do it by cobol pgm also.
File1=1,file2=11 and
fd file3
01 file3-rec
05 ws1 pic 9(1) value zero.
05 ws2 pic 9(2) value zero.
open file1 in inpute mode and write the record in file3
which is opened in output mode. Now open file2 in input and
file3 in IO mode and update the record.
I think it should work.
Muttiah, would you suggest any better approach by using JCL
thn please share with us. Thanks
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / muttiah
Nishant,
Thanks for your answer. It's a correct approach to achieve
the result as '111' in file 3..
I'm not sure how this can be done in JCL.
Can someone suggest how this can be achieved.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ram mohan
@MDV:
I have tested the code. but it's giving Maxcc - 16. Can you
please give us the exact JCL. I feel Joinkeys are not
supporting in the sort which we are using.
thanks in advance.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / msharib
One can try this
//STEP2 EXEC PGM=SORT
//IN1 DD *
1
/*
//IN2 DD *
111
/*
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(1,1,A)
JOINKEYS F2=IN2,FIELDS=(1,1,A)
REFORMAT FIELDS=(F1:1,1,F2:1,3)
OPTION COPY
/*
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / muttiah
@satish:
I'm not sure on what basis you have created this jcl. But
if i'm your interviewer i would have blasted you like
anything.
Findings:
1. step1 output will be 1 in postion 1 followed by 001 in
pos 60 - 62.
2. step2 output will be 111 in position 1-3 followed by 002
in pos 60-63. why the hell are you hardcoding sortin in
both the steps and sortout of step2 you are force fully
making it come as '111' because of this
OUTREC FIELDS=1:C'1',2:1
Then what is the case of having step1 if you force fully
making it as '111'..
Coming to step4: i'm not sure what does it mean but i
executed and saw like the output is in this format.
111 in pos 1-3 and 001 in pos 60-62.
Then where are you eliminating 001 in cols 60.
If you are not sure of the answer don't post anything. But
never divert people with your answers. People who are new
to mainframe can feel your answer is correct.
Is This Answer Correct ? | 0 Yes | 3 No |
List in order the hierarchical levels of jcl?
how can i use the parameters decalred in main pgm in sub pgm
what is the meaning of 'sysin dd dummy'
Is there any command to check wether the ps file is in sorted order?
what is the use of IEBGENER utility?
Please go thru the below points and let me know how to code this. 1. Sort the input dataset for the condition : Starting position is 37,length of the field is 13 based on character and in the ascending order , starting from position 25 length of 12 ,character and in the ascending order. Use a temporary dataset to hold the sorted file. 2. Use the temporary file created in the above step as the input for the next step. The next step is to execute a program and produce an output file. Use the temporary file created in the above as work file 1 and the output of the file to be created in this step work file 2.Also, pass a parameter to the program that is to be executed in this step. The parameter should have the current date in YYYYMMDD format. For the sake of convenience, you can use the below Job Name : Sample1 Input DSN : PCABDT11.CABD.TEST.INPUT Temporary DSN : Sort1 Output DSN : PCABDT11.CABD.TEST.OUTPUT Program Name : SAMPLE Thanks in Advance for your response.
In JCl which of this activities get executed if act002 abnormally terminates //job001 job ......... //act001 exec pgm=cobo01 //act002 exec pgm=cob02, cond=(01,le) //actoo3 exec pgm=cob03, cond=only //actoo4 exec pgm=con04
What are some jcl statements that are not allowed in procedures?
When we give TYPERUN = SCAN , what are the syntax errors we get?
How to exclude the duplicate records from two concateded flat files (records from both files must be removed)?
hi friends........if u know syntax of IEBEDIT IN JCL
What statement can be used to send data to another mvs jes3 node?