Showing posts with label COBOL ebooks. Show all posts
Showing posts with label COBOL ebooks. Show all posts

Friday, December 17, 2010

How do I setup the Assemble-Link Job(JCL)?

Before you start writing Programs, you need to set up an Assemble-Link job(JCL), that'll help assemble your program into a Load Module. Once you have a Load-Module ready, you can run it and see the magic.

Most installations have ready-to-use PROCS such as ASMHC to assemble a Program, ASMHCL to assemble-and-link a Program and ASMHCLG to Assemble-Link-Go(Run) the program. If these aren’t found at your shop, try looking for ASMAC, ASMACL and ASMACLG. Better even ask your System Programmer for a JCL. The Assembler-software on Mainframes is the Program ASMA90. This is how I have setup my Assemble-link Job. I am going to use the ready-made PROC ASMACL.  There are two important customizations or overrides you need to do. ASMACL expects you to supply two Files – //SYSIN, the Input Source Program, and //SYSLMOD, the output Load Module. I have stored my Source-Program in the Member ASPROGR01 under the Library SYSADM.DEMO.SRCLIB. I hooked up and attached SYSIN inlet to this file SYSADM.DEMO.SRCLIB(ASPROG01). The Assembler internally passes its output to the Linker. The Linker-Software HEWL, produces an Output Load Module and stores it in the SYSLMOD File. I would like the Executable Load Module ASPROG01 to be created under SYSADM.DEMO.LOADLIB. Hence, SYSLMOD output is hooked to the File SYSADM.DEMO.LOADLIB(ASPROG01).

How does the SUBTRACT Operator work in COBOL?

When you want to find the difference of two or more quantities in COBOL, you use the SUBTRACT operator. The SUBTRACT operator subtracts one quantity from another, and finds out the result. In its simplest form, SUBTRACT has the following syntax :
Syntax
SUBTRACT one-quantity FROM second-quantity

For example,

SUBTRACT WS-VAR-2 FROM WS-VAR-1

Consider the variable WS-VAR-1 = 10, WS-VAR-2=30, subtracting WS-VAR-2 from WS-VAR-1 would result in the difference between 30 and 10. The answer is 20. This final result is stored in WS-VAR-2. SUBTRACT B FROM A is equivalent to the statement A = A – B.

Image03[2] 

The example above is shown in the code snippet below :

Image04[2]

COBOL ADD Operator Example

Syntax
ADD A B C GIVING D E
The GIVING Clause may also specify a list of destination/receiving variables. In that case, sum(addition) is copied to the each of the variables mentioned in the GIVING Clause. For example,
Assume that A = 10, B = 15 and C=20.

Now the sum of A B C = 10 + 15 + 20 = 45. The sum 45 is stored in each of the variables mentioned in the list(D, E). Thus,
D = 45 and E = 45, after the above statement is executed.

Example :

Image16[2]
Result :

Image17[1]

ADD operator in COBOL example

Syntax
ADD A B GIVING RESULT

If you would like the final result of arithmetic to be stored in a separate resultant variable, you can always write a GIVING clause at the end. Thus, if A=5 and B=10, the sum(addition of A and B), would yield 15. This sum 15 is stored in the RESULT Variable. On omitting the GIVING Clause, the sum is stored in one of the operands being added. GIVING Clause allows you to specify a separate destination(receiving variable) which shall hold the final result of computation.
Example
Image14[2]

Result
Image15[1]

COBOL Tutorial – Arithmetic Operators part 2

How is the the ADD Operator used in COBOL.?

The ADD operator can be used to add two or more quantities. In the assembly language, we write the instruction ADD A B to find the sum of A and B. The final sum is stored in A. On the same lines, the ADD Operator in COBOL has the following syntax :

Syntax
ADD one-quantity TO second-quantity

The final sum result is stored in the second-variable. For example, if A=10, and I write

ADD 5 TO A
After performing the above step, the computer adds 5 to the value of A, so A=15. Suppose a variable B=5, then I may also write

ADD B TO A
Syntax
ADD A B C TO SUM
In this case, all the three group of numbers A B and C, would be added to SUM. So, assuming A=10, B=15, and C=20, if initially RESULT = 100, after addition of A, B and C to SUM, the value of RESULT = 100 + (10+15+20) = 145.

Example 

Image12[1] 

Result 

Image13[1]

Saturday, December 12, 2009

What are the differences between COBOL and COBOL II?


What are the differences between COBOL and COBOL II?
There are at least five differences: COBOL II supports structured programming by using in line PERFORMs and explicit scope terminators, it introduces new features (EVALUATE, SET .. TO TRUE, CALL .. BY CONTEXT, etc), it permits programs to be loaded and addressed above the 16 megabyte line, it does not support many old features (READY TRACE, REPORT-WRITER, ISAM, etc.), and it offers enhanced CICS support. 

How will work GOBACK statement & STOP RUN & EXIT-PROGRAM in COBOL ?

Question :How will work GOBACK statement & STOP RUN & EXIT-PROGRAM in COBOL ?


Answers :


goback 
- When specified in main program, will act like stop run. i.e give control back too O.S
- When specified in sub-program, will give control back to main program

Exit-program
- When specified in main program, will throw abend4038 (compilation) error, since it wont give the control back to the O.S
- When specified in sub-program, will give control back to main program

stop run 
- Will stop the current program and give control back to O.S (even in sub-program)



Answer2:


GOBACK gives the controll to main program if we have called the subprogram from the main program.

STOP RUN: This statement halts the execution of the object program and returns control to the system.

EXIT-PROGRAM: This statement specifies the end of a called program and returns control to the calling program.

COBOL Tutorial – Arithmetic Operators

Q. How do you perform Arithmetic in COBOL? For example, how do you write a simple program that calculates the Interest to be paid on a Principal p?

You often need to do Math in COBOLYou can perform Arithmetic in COBOL using Arithmetic Operators. When you perform some arithmetic on two or more numeric quantities, such an expression is called an Arithmetic Expressions. There are 4 main Arithmetic Operators in COBOL – ADD, SUBTRACT, MULTIPLY and DIVIDE.

You can even write complex arithmetic expressions by using the COMPUTE verb. I have written about the syntax of each operator, followed by examples and some results. 

2. How’z the ADD Operator used in COBOL
The ADD operator can be used to add two or more quantities. In the assembly language, we write the instruction ADD A B to find the sum of A and B. The final sum is stored in A. On the same lines, the ADD Operator in COBOL has the following syntax :

Syntax

ADD one-quantity TO second-quantity

The final sum result is stored in the second-variable. For example, if A=10, and I write

ADD 5 TO A
After performing the above step, the computer adds 5 to the value of A, so A=15. Suppose a variable B=5, then I may also write

ADD B TO A


Syntax

ADD A B C TO SUM

In this case, all the three group of numbers A B and C, would be added to SUM. So, assuming A=10, B=15, and C=20, if initially RESULT = 100, after addition of A, B and C to SUM, the value of RESULT = 100 + (10+15+20) = 145.

Monday, May 4, 2009

VS COBOL II papers, ebooks and articles

You can download various papers, articles and e books of VS COBOL II from here. By referring this free study materials and e books, you can learn following VS COBOL II topics.
  1. Introduces VS COBOL II and its features.
  2. You can learn VS COBOL II language format, reserved words, return code and compiler options, etc.
  3. Learn evaluating techniques of VS COBOL II for your data processing operations.
  4. Learn various factors effecting performance of COBOL programs when using VS COBOL II.
  5. Familiar with tuning the run-time environment for better CPU performance.
  6. You can develop VS COBOL II programs, compile, link-edit and execute VS COBOL II. programs under MVS or CMS.
  7. You can learn Debugging tools to identify and correct problems in a VS COBOL II programs.
  8. You can migrate existing DOS/VS COBOL programs to VS COBOL II programs and can also migrate CMPR2 programs to NOCMPR2 Programs.
  9. You can develop VS COBOL II and OS PL/1 applications using CODE/370 and LE/370.
  10. You can understand how to prepare VS COBOL II for use under MVS/ESA and MVS/XA.
  11. Learn how to prepare VS COBOL II for use under VSE/ESA.
  12. Explains applications of program design, coding, compilation, link-editing and executing VS COBOL II
Following are the VS COBOL II ebooks available free to download. You can download or read it now from these links.
  1. VS COBOL II Release 3.2 and Release 4.0 Performance Tuning
  2. VS COBOL II V1R4.0 General Information (GC26-4042-08)
  3. VS COBOL II V1R4.0 Application Programming: Language Reference (GC26-4047-07)
  4. VS COBOL II V1R4.0 Application Programming Guide for MVS and CMS (SC26-4045-05)
  5. VS COBOL II V1R4.0 Application Programming Guide for VSE (SC26-4697-01)
  6. VS COBOL II V1R4.0 Application Programming Debugging (SC26-4049-05)
  7. VS COBOL II V1R4.0 Migr Guide for VSE (GC26-3150-00)
  8. VS COBOL II V1R4.0 Migr Guide for MVS and CMS (GC26-3151-00)
  9. VS COBOL II Application Programming Reference Summary (SX26-3721-04)
  10. VS COBOL II V1R4.0 Application Programming Ref Sum (SX26-3721-05)
  11. CODE/370 V1R2 with VS COBOL II, OS PL/I (SC09-1862-01)
  12. VS COBOL II V1R4.0 Installation and Customization for CMS (SC26-4213-05)
  13. VS COBOL II V1R4.0 Install and Cust for MVS (SC26-4048-05)
  14. VS COBOL II Installation and Customization for CMS (SC26-4213-04)
  15. VS COBOL II V1R4.0 Installation and Customization for VSE (SC26-4696-01)
  16. VS COBOL II Application Programming Guide for MVS and CMS (SC26-4045-04)
  17. Using CODE/370 with VS COBOL II (SC09-1862-00)
Related COBOL and other Mainframe ebooks
  1. Download free mainframe ebooks (More than 175 books)
Buy VS COBOL II Books
  1. Advanced ANSI Cobol With Structured Programming: For Vs Cobol II and Microsoft Micro Focus Cobol
  2. Vs Cobol 2: A Guide for Programmers and Managers
  3. Cobol/370: For Vs Cobol and Cobol II Programmers (J Ranade Ibm Series)