Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Semrush - keyword research tool

Create your online store today with Shopify

Turn ChatGPT, Claude, Gemini, And CoPilot Into Your Personal Assistant, Business Coach, Content Creator, And More

AFFILIATE MARKETING Your all-in-one performance engine Manage affiliates, creators, and customer referrals in one unified platform—turning every partnership into measurable growth

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Disclosure: My content contains affiliate links.

43,568 questions

56,786 answers

573 users

How to divide variables in COBOL

2 Answers

0 votes
IDENTIFICATION DIVISION.
PROGRAM-ID. COBOL-PRO.
 
DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 A-NUM1 PIC 9(3) VALUE 17.
   01 A-NUM2 PIC 9(3) VALUE 5.
   01 A-NUM3 PIC 9(3) VALUE 13.
   01 A-NUM4 PIC 9(3) VALUE 22.

PROCEDURE DIVISION.
   DIVIDE A-NUM1 BY A-NUM2 GIVING A-NUM3 REMAINDER A-NUM4.

   DISPLAY "A-NUM1 : " A-NUM1
   DISPLAY "A-NUM2 : " A-NUM2
   DISPLAY "A-NUM3 : " A-NUM3
   DISPLAY "A-NUM4 : " A-NUM4

STOP RUN.
 
 
 
*> run:
*> 
*> A-NUM1 : 017
*> A-NUM2 : 005
*> A-NUM3 : 003
*> A-NUM4 : 002
*>

 



answered Sep 18, 2020 by avibootz
edited Jan 20, 2023 by avibootz
0 votes
IDENTIFICATION DIVISION.
PROGRAM-ID. COBOL-PRO.
 
DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 A-NUM1 PIC 9(3) VALUE 17.
   01 A-NUM2 PIC 9(3) VALUE 173.

PROCEDURE DIVISION.
   DIVIDE A-NUM1 INTO A-NUM2.

   DISPLAY "A-NUM1 : " A-NUM1
   DISPLAY "A-NUM2 : " A-NUM2

STOP RUN.
 
 
 
*> run:
*> 
*> A-NUM1 : 017
*> A-NUM2 : 010
*>


 



answered Sep 18, 2020 by avibootz
edited Jan 20, 2023 by avibootz

Related questions

1 answer 217 views
2 answers 432 views
432 views asked Sep 18, 2020 by avibootz
2 answers 468 views
468 views asked Sep 17, 2020 by avibootz
2 answers 456 views
456 views asked Sep 17, 2020 by avibootz
1 answer 370 views
370 views asked Sep 17, 2020 by avibootz
1 answer 379 views
379 views asked Sep 17, 2020 by avibootz
...