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

jcl is like a complier....?

6 Answers  


Are there any set of rules for the names of the steps used in a job? What are they?

0 Answers  


how can i use the parameters decalred in main pgm in sub pgm

2 Answers   TCS,


how many max steps can we use in a job? pls answer to my question

9 Answers   TCS,


how to compress the data set

8 Answers   Keane India Ltd,






Brief description of inline procedure of jcl.

0 Answers  


How many positional parameters are there in job statement?

4 Answers  


What does a disposition of (MOD,DELETE,DELETE) mean ?

0 Answers  


wht is the d/f between positional parameter n keyword parameter ?

1 Answers  


What is the difference between a symbolic and an override in executing a PROC?

2 Answers  


Is it possible to take a PDS and write it to a GDG? If so, can you provide an example? Thanx

7 Answers  


Suppose I have Five Steps in PROC In this Case I want to Execute third Step in PROC using Main JCL don't use any COND Explain with Coding Thanks & Regards SHREE

4 Answers   Merrill Lynch,


Categories