Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us