Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


differnce between read work file 1 and read work file once?
why we are using work file once?

Answers were Sorted based on User's Feedback



differnce between read work file 1 and read work file once? why we are using work file once?..

Answer / niki

Both used to read sequentila file.
Read work file 1:

1. is a processing loop strating like:
Read work file 1 file1
---
--
--
end- work.
Here ---> file 1 is file name here and 1 is arbitary file
number which is translated into dataset names CMwk01 in jcl.

read work file once:
1. Reads only one reacord is to be read.
2. there is no processing loop
eg. Read work file once


do correct me if i am wrong?

Is This Answer Correct ?    8 Yes 0 No

differnce between read work file 1 and read work file once? why we are using work file once?..

Answer / satya

To answer why do we use READ WORK FILE 1 ONCE

It is generally used when you specifically want to know if
the input file is empty programatically and if you would
like to handle the way you wanted if the file is empty,just
like below,

READ work 1 ONCE #WORK
AT END OF FILE
Write "Input empty"
terminate 99
END-ENDFILE

this piece of code can be placed at the begining of your
program and this helps to avoid unnecessary entry into
programming statements with empty file in input, unless
expected

Is This Answer Correct ?    8 Yes 1 No

differnce between read work file 1 and read work file once? why we are using work file once?..

Answer / kevin

As NIKI stated the read work file 1 is identifying the work
file in JLC

As for the work read work file once it is used to get the
next record. The record pointer doesn't get reset allow
you to process records from 2 files one at at time.

For example if you are comparing record from 2 work files
and processing the records in order


read work a once /* reads the first a record
read work b once /* reads the second b record

REPEAT
IF rec-a > rec-b
process b ...
read work b once
escape top
End-if
IF rec-a < rec-b
process a ...
read work a once
ecape top
End-if
If rec-a = rec-b
process a and b ...
read work a once
read work b once
end-if
end-repeat

(of course you would need escape logic in the loop such as
end of file logic...)

Is This Answer Correct ?    2 Yes 0 No

differnce between read work file 1 and read work file once? why we are using work file once?..

Answer / nisha

Read Work file 1
Will read dataset details defined as CMWRK01 from JCL.

Read work file once
Will read first record from the input file

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Natural Interview Questions

The natural file converted to PDF file if Yes then explain ?

0 Answers  


difference between escape(top or bottom) and escape immediate(top or bottom?

3 Answers   CTS,


differnce between read work file 1 and read work file once? why we are using work file once?

4 Answers  


Explain the like inverted list?

0 Answers  


How to receive data passed through jcl parm parameter in a natural program?

0 Answers  


Does Natural online require CICS or other TP systems to function? How does Natural interact with CICS? Thanks.

1 Answers  


Describe the COBOL coding sheet

2 Answers   Cap Gemini, Royal Infotech,


how we can find occurence of MU and PE fileds in a file?

2 Answers  


What is the difference between read work file 1 and read work file once? Why we are using work file once?

0 Answers  


What is Natural?

4 Answers   TCS,


Explain the data storage?

0 Answers  


How to receive data passed through jcl parm parameter in a natural program? How data definition is defined in the program?

0 Answers  


Categories