vaneesh khurana


{ City } pune
< Country > india
* Profession * software engineer
User No # 84460
Total Questions Posted # 0
Total Answers Posted # 43

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 139
Users Marked my Answers as Wrong # 66
Answers / { vaneesh khurana }

Question { Accenture, 10610 }

I have program P1 which calls file F1 which has 100 records
and following structure
001 ..................
002 ..................
003 ..................
098 ....................
099 ...................
100 ....................

Now I want to read these files and write these records in
file F2 in following manner.

001 ...... 051 .....
002 ...... 052 .....
003 ...... 053 .....
.......... .......
.......... .......
.......... .......
048 ........ 098 ......
049 .......... 099 .......
050 .... 100 ......


Answer

Hi Krishnan A

How will how will you split the file into 50-50. Please let
me know with the sort card.

Vaneesh

Is This Answer Correct ?    0 Yes 0 No

Question { Accenture, 12853 }

Why we need to use redefine clause when we can define the
variable seperately... what is actual need....


Answer

One more advantage of redefines is that we can use the same
value with different declarations.
For Example
lets say we receive input value as 'b123'. b is blank
and we want to display it as 01.23 in the spool. This can
be done with redefines as follows.

WORKING-STORAGE section
01 LEARNING
05 WS-RECIEVE-VAL PIC X(4).
05 WS-RECIEVE-RED REDEFINES WS-RECIEVE-VAL PIC 9(2)V
(2).

01 WS-FOR-DISPLAY PIC 9(2).9(2).

PROCEDURE DIVISION.

MOVE 'b123' TO WS-RECIEVE-VAL
MOVE WS-RECIEVE-RED TO WS-FOR-DISPLAY

DISPLAY WS-FOR-DISPLAY

STOP RUN.

Is This Answer Correct ?    4 Yes 0 No


Question { 7652 }

copy 100 records without using ibm utilities


Answer

MOVE 0 TO WS-COUNTER
MOVE N TO END-OF-FILE

PERFORM 1000-COPY-PARAGRAPH UNTILL (WS-COUNTER = 100 OR END-
OF-FILE = 'Y'.

100-COPY-PARAGRAPH.
READ INPUT FILE
AT END MOVE Y TO END-OF-FILE
NOT AT END MOVE IN-REC TO OUT-REC
ADD +001 TO WS-COUNTER.
1000-EXIT.
EXI.

Is This Answer Correct ?    4 Yes 0 No

Question { 16092 }

How will fetch last 5 rows from table in db2


Answer

See there is no direct method to do so, but still if we want
last 5 rows only we can create a logic which is as follows.

1. Declare an array to save the fetch rows with occurs of 5.
2. Now fetch the rows and start saving in that array such
that when the count becomes 5 overwrite the 6th fetch in the
first occurs similarly the 7th fetch on the 2nd occur.
3. Now when all the fetching is done the array will contains
the last 5 fetched rows.

Is This Answer Correct ?    2 Yes 2 No

Question { 16092 }

How will fetch last 5 rows from table in db2


Answer

Hi Harsha,

There is nothing to do with multiple of 5.
Simply declare the array of occours of 5 keep on filling
it when 6th record comes start over writing it from 1st.

At last we only left with the last 5 fetched rows.

Vaneesh Khurana

Is This Answer Correct ?    1 Yes 0 No

Question { 7434 }

how to code instream data in procedure?


Answer

We can't write
//SYSIN DD *
but i think we can code
//SYSIN DD DSN=SYSIN.PS,DISP=SHR

where SYSIN.PS is a 80 byte file containing SYSIN statements.

Not sure about it.

Is This Answer Correct ?    3 Yes 1 No

Question { Wipro, 7352 }

I have GDG defined e.g. GDG.smaplegdg.base, after processing the GDG. it contains some records and which is input to the second step2.
How can I use GDG to use it as input file at step2.


Answer

In the same jcl if we have to refer a GDG version which was
build in any previous step then have to mention it as (+0)
not (+1)

//STEP1 DD DSN=GDG.smaplegdg.base(+1),
Disp=(NEW,CATLG,DELETE)

//STEP2 DD DSN=GDG.smaplegdg.base(+0),DISP=SHR

Is This Answer Correct ?    1 Yes 21 No

Question { TCS, 8775 }

how to write a jcl prog to copy alternate recs from ps1 to
another ps2,suppose ps1 having 10 recs?


Answer

To do so we require OUTFIL and SPLIT option of DFSORT.

//STEPNAME EXEC PGM=SORT
//SORTIN DD DSN=SORTIN.INPUT.FILE.TO.SPLIT,DISP=SHR
//PS1 DD DSN=PS1.FILE,DISP=SHR
//PS2 DD DSN=PS2.FILE,DISP=SHR
//SYSIN DD *
OUTFIL FNAMES=(PS1,PS2),SPLIT
/*

This will write 1st, 3rd,5th ....record in the PS1 and
2nd,4th,6th ....record in ps2 file.

Is This Answer Correct ?    14 Yes 3 No

Question { Cognizant, 27609 }

Suppose I have 5 dataset listed under a single DD name in a
catlogued PROC. How can I override one of those 5 dataset
(say 3rd dataset)?


Answer

Calling catalog proc
Pass the symbolic parameter name to C while executing
proc(CATPROC)

//STEP1 EXEC CATPROC,C=NAME2
------------------------------------

Catlaog Proc

Here third dataset name which was "THIRD.FILENAME" earlier
will get overridden with "NAME2.FILENAME"

//CATPROC PROC A=FIRST,B=SECOND,C=THIRD,D=FOURTH,E=FIFTH

//STEP2 EXEC PGM=PGM1

//DFILES DD DSN=&A..FILENAME
DD DSN=&B..FILENAME
DD DSN=&C..FILENAME
DD DSN=&D..FILENAME
DD DSN=&E..FILENAME

Is This Answer Correct ?    2 Yes 1 No

Question { CSC, 7422 }

can a job be submitted through jcl only? is there another way
to submit a job?


Answer

A job can also be submitted from a cobol program using
INTRDR

Is This Answer Correct ?    10 Yes 2 No

Question { DELL, 19233 }

i have 10,000 records in one input file.i want to sort 1 to
5000 records in one outputfile and remaining records sort in
another output file write the syntax for this?


Answer

One more bethod is there, i.e. by using SPLIT1R

OUTFIL FNAMES=(FILE1,FILE2), SPLIT1R=5000

Is This Answer Correct ?    5 Yes 1 No

Question { Satyam, 16082 }

In JCL..for TIME Parameter was specified both JOB &
STEP..which one is overrides


Answer

In that case smaller time will be applicable.

Is This Answer Correct ?    2 Yes 10 No

Question { Wipro, 14590 }

PLAN IS EXECUTABLE AND PACKAGE IS NOT EXECUTABLE . THEN WHAT
IS THE USE OF PACKAGE?


Answer

See there is not doubt that PLAN is an executable form of
DBRM and package is not the executable form.
Basically a DBRM can be linked to PLAN directly or a DBRM
can be linked to Package and that package can further linked
to the PLAN
Now if we directly link the DBRM with the plan then every
time we recompile the program(DBRM) we have to regenerate
the plan.
Whereas if we link the DBRM via package then every time we
recompile the program(DBRM) we only require to recompile the
Package.
Hence Binding through package prevents regeneration of plan.

1 more line I want to add just for knowledge.
If we regenerate the PLAN every time then all the other
Programs(DBRMs) which are attached to that same PLAN
required to be rebind thus take waste time.


Hope this answers your query...

Is This Answer Correct ?    27 Yes 2 No

Prev    1   2    [3]