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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write the code to count the sum of n natural numbers.

1194


Whats the difference between search & search ALL?

6492


What is the LINKAGE SECTION used in COBOL?

1515


What type of SDLC u followed? Why?

1984


What is the difference between next sentence and continue in cobol programing language?

1196


HOw can I get the negative sign while deduct high value from low value

2243


Describe the cobol database components?

1160


What is the difference between external and global variables in COBOL?

1437


Can we redefine the field of x(200) to less than 200?

1349


example for sub strings ? and refernce modifications whit output pls

2298


i need a small 3d program using inline and outline.

2194


I need to compare 3 variables(dates) and do some processing based on the earliest date. There could be more then 1 date record in any of the 3 fields. What is the best way to code this?

2259


Name some of the examples of COBOl 11?

3124


how do you reference the variable unblock file formats from cobol programs

1308


A table has two indexes defined. Which one will be used by the SEARCH?

1270