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

Can a PROC CALL another PROC ? (in both Instream and Cataloged cases) ?

3 Answers   IBM,


What dd statement is used to supply the name of a dataset?

0 Answers  


Can we use empty VSAM as input?

9 Answers   Convergys, Kanbay,


what JCL Procedures?

0 Answers  


How do you override a specific DDNAME/SYSIN in PROC from a JCL?

6 Answers   CTS,






What is the significance of addrspc parameter in the exec statement?

0 Answers  


How can the disposition of sysout datasets be set for an entire jobstream?

0 Answers  


How to find in aparticular step how many versions a paricular gdg base have?

4 Answers   TCS,


once we submitted the job to the operating system, how can we cancel the job before execution?

2 Answers  


How does -818 sql error occur? Why does it happen and what can be done to overcome this error code?

5 Answers   RBS,


what EXEC statement is and what is the syntax of EXEC statement used in JCL?

0 Answers  


wht is step lib n job lib ? where can we code joblib n steplib ?

3 Answers   L&T,


Categories