Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sample Program to display all odd integers betweem 1 to 100

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
srini_gunja
Currently Banned

New User


Joined: 24 Aug 2005
Posts: 7

PostPosted: Mon Sep 11, 2006 12:03 pm    Post subject: Sample Program to display all odd integers betweem 1 to 100
Reply with quote

Hi all,
I am new to cobol and I m in learning phase.
Please do the needfull in writing the cobol programs.


1) Program to display all odd integers betweem 1 to 100


2) Program to count number of records in the inputfile

Thanks,
Srini.
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Mon Sep 11, 2006 12:25 pm    Post subject:
Reply with quote

PERFORM VARYING I FROM 1 BY 1 UNTIL I>101
DIVIDE I BY 2 GIVING J REMAINDER K
IF K EQ 0
DISPLAY I
END-IF
END-PERFORM.


2.

to count number of record in i/p file u can do it by ICETOOL
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Mon Sep 11, 2006 12:27 pm    Post subject:
Reply with quote

I recommend to start by reading the fine manual. After reading it, let us know if you need more help.

O.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Tue Sep 12, 2006 4:19 am    Post subject: Re: Sample Program to display all odd integers betweem 1 to
Reply with quote

Srini wrote:

1) Program to display all odd integers betweem 1 to 100


Code:

PERFORM VARYING SUB FROM 1 BY 2 UNTIL SUB > 100
    DISPLAY SUB
END-PERFORM


Dave
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Binary to display characters Roy Ware SYNCSORT 3 Tue Sep 19, 2017 8:46 pm
No new posts DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm
No new posts Suppress value reported by BREAK in D... Learncoholic DFSORT/ICETOOL 3 Wed Aug 16, 2017 6:03 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm
No new posts pre-compiler for program in an HFS Pedro DB2 0 Fri Jun 23, 2017 11:13 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us