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



Write a JCL by using the below requirement: File1 =1, File2 =11 and output needs to come as File3 =..

Answer / gaurav

Can be obtained using JOINKEYS or ICETOOL

Is This Answer Correct ?    4 Yes 0 No

Write a JCL by using the below requirement: File1 =1, File2 =11 and output needs to come as File3 =..

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

Write a JCL by using the below requirement: File1 =1, File2 =11 and output needs to come as File3 =..

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

Write a JCL by using the below requirement: File1 =1, File2 =11 and output needs to come as File3 =..

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

Write a JCL by using the below requirement: File1 =1, File2 =11 and output needs to come as File3 =..

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

Write a JCL by using the below requirement: File1 =1, File2 =11 and output needs to come as File3 =..

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

Write a JCL by using the below requirement: File1 =1, File2 =11 and output needs to come as File3 =..

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

Write a JCL by using the below requirement: File1 =1, File2 =11 and output needs to come as File3 =..

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

Post New Answer

More JCL Interview Questions

How do you send the output of a COBOL program to a member of a PDS?

7 Answers  


What is primary allocation for a dataset?

4 Answers  


Name some of the JCL statements that are not allowed in procs.?

1 Answers  


i have 3 steps in my jcl, where i want to run only one step at a time depending on the variable. How should i give the condition statement... I have tried this with two steps which is working but not able to add condn for the 3rd step. can anyone help me... I want to know the cond stmt which i can code in step 3 and step4, so that only either step2 or step3 or step4 executes

3 Answers  


What is the difference between the JOBLIB and the STEPLIB statements?

3 Answers  






Explain about Specifying compiler options in the PROCESS (CBL) statement

1 Answers  


How are datasets concatenated?

3 Answers   CitiGroup,


How is a dataset passed from one step to another?

2 Answers   DELL,


In order to continue a job after a return code of 12 in step1, what the step2 exec statement include?

1 Answers  


how can the same proc be re-used and called by many jobs?

0 Answers   IBM,


How do you run a COBOL batch program from a JCL? How do you run a COBOL/DB2 program?

0 Answers  


I have 5 steps in my jcl ,I need to execute first three steps and then 2nd step again ,4th and 5th steps if rc of 2nd step is zero

1 Answers   ABC,


Categories