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...


have in 100 records in a file i want to read first 3 records
and skip next 3 records and agan i want to read 3 records and
again i want to skip 3 records...

Answers were Sorted based on User's Feedback



have in 100 records in a file i want to read first 3 records and skip next 3 records and agan i w..

Answer / kairoon

In working storage declare
01 ws-count1 pic s9(4) comp value zeroes.
01 ws-count2 pic s9(4) comp value zeroes.

In procedure division

PERFORM 200000-PROCESS THRU 200000-EXIT
UNTIL WS-EOF-IN = 'Y'.
200000-PROCESS.

READ IN-FILE AT END MOVE 'Y' TO WS-EOF-IN
GO TO 200000-EXIT.
ADD 1 TO WS-COUNT1
IF WS-COUNT1 <= 3
MOVE IN-REC TO OUT-REC
WRITE OUT-REC
ELSE
ADD 1 TO WS-COUNT2
IF WS-COUNT2 = 3
MOVE ZEROES TO WS-COUNT1
WS-COUNT2
END-IF
END-IF.
200000-EXIT.
EXIT.

Is This Answer Correct ?    26 Yes 3 No

have in 100 records in a file i want to read first 3 records and skip next 3 records and agan i w..

Answer / santhosh

We can do it through JCL by using sort utility ..Through splitby=3 in outfil statement giving two different outputs..It will store two alternative records into two datasets alternatively

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More COBOL Interview Questions

whn do i get soc7 abend while moving alphanumeric to numeric or while moving numeric to aplhanumeric please reply ASAP?

9 Answers  


what are the isolation levels and where we use it in the db2 program

3 Answers   TCS,


What is the difference between SEARCH and SEARCH ALL?

6 Answers   Cognizant,


can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there

1 Answers  


How to define a array dynamically.....

5 Answers   Fidelity,


What was removed from COBOL in the COBOL II implementation?

0 Answers  


How to concatenation one or more string?

4 Answers   Temenos,


What will happen if you code GO BACK instead of STOP RUN in a stand-alone COBOL program i.e. a program which is not calling any other program ?

3 Answers  


what are the paramater we cannot use in procedure?how many instream we can write in single jcl?can we call instream to catalog and ctalog to instream?

2 Answers   Satyam,


What is the difference between CALL BY VALUE and CALL BY CONTENT?

7 Answers  


1) can we display the index?

3 Answers   ADP, IBM,


In A cobol program , we can use COPY Statement in FILE- SECTION / WORKING-STORAGE SECTION / ENVIRONMENT DIVIION basically what is the difference

3 Answers   IBM,


Categories