GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Mainframe  >  COBOL
Go To First  |  Previous Question  |  Next Question 
 COBOL  |  Question 107 of 162    Print  
what are the ways for passing a variables? tell me all the possibilities please.

  
Total Answers and Comments: 1 Last Update: May 02, 2007     Asked by: Suganj 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
May 01, 2007 23:53:12   #1  
ranju        

RE: what are the ways for passing a variables? tell me...

Variables can be passed

1) by content

The called program accesses and processes a copy of the variables from
calling program's storage and cannot change actual value of the variables

in the caller's storage.


2) by reference

The called program accesses and processes the variables in the calling
programs storage and so can change the value of the variable.


eg:

CALLING PROGRAM

***************

ID DIVISION.







WORKING-STORAGE SECTION.

77 l-subpgm-1 pic x(8) value SUBPGM1 .

01 l-parm1.

05 l-name pic x(30).

05 l-emp-no pic 9(4).

01 l-parm2.

05 l-salary pic s9(9)v99 comp-3.

05 l-hra pic s9(9)v99 comp-3.

05 l-leave pic s9(2)v9 comp-3.

01 l-parm3.

05 l-gross pic s9(9)v99 comp-3.

05 l-deduct pic s9(9)v99 comp-3.

PROCEDURE DIVISION.

....

CALL l-SUBPGM1 USING

BY CONTENT l-parm1 l-parm2

BY REFERENCE l-parm3.


CALLED PROGRAM

**************

ID DIVISION.

PROGRAM-ID. 1-SUBPGM1.



LINKAGE SECTION.

01 L-parm3.

05 l-gross pic s9(9)v99 comp-3.

05 l-deduct pic s9(9)v99 comp-3.

01 L-parm1.

05 l-name pic x(30).

05 l-emp-no pic 9(4).

01 L-parm2.

05 l-salary pic s9 (9) v99 comp-3.

05 l-hra pic s9(9)v99 comp-3.

05 l-leave pic s9(2)v9 comp-3.

PROCEDURE DIVISION USING

L-parm1 L-parm2 L-parm3


 
Is this answer useful? Yes | No

 Related Questions

Wake up - you haven't been paying attention! It's not possible to pass an index via linkage. The index is not part of the calling programs working storage. Those of us who've made this 
Latest Answer : We can pass subscript by linkage section. index cant. ...

I have a variable x(20), but i need the out as in two ways One is 1.12300000000000000000, other one is 2.123-----------------?
Read Answers (5) | Asked by : samayamsas

Can we fetch select in working storage section variables directly without using the host variables?
Read Answers (5) | Asked by : Abhishek mangal

A place to reserve storage for data that is not part of the program's input or output. This area contains fields that are used as temporary storage while the program is executing. Some temporary storage 
Latest Answer : you need the section to define all your variables.But you don´t have to hardcode. You can copy a copybook, where you´re variables are inside. let me know, if you need more details. ...
Read Answers (1) | Asked by : irinak

Latest Answer : Variables can be passed 1) by content    The called program accesses and processes a copy of the variables from calling program's storage and cannot change actual value of the variables    in the caller's storage. 2) ...
Read Answers (1) | Asked by : Suganj

I tried in many ways, but it loops over again and again in the last record and reports me abend error. 
Latest Answer : In this code i am using cnt for finding the number of records.0700-LOAD-UOM-FILE.READ MPSF-item-FILE AT END MOVE WSL-Y TO WSW-ITEM-FILE-SWT MOVE WS-ITEM-TAB-CNT TO WS-UOM-ITEM-MAX GO TO 0700-LOAD-UOM-FILE-EXIT. ADD WSC-1 TO WS-ITEM-TAB-CNT. IF ...
Read Answers (4) | Asked by : Bhuvaneswari Raman


 Sponsored Links

 
Related Articles

ODP.NET - Working with Bind Variables together with OracleParameter

ODP NET Working with Bind Variables together with OracleParameter With the help of OracleParameter you can include bind variables within any SQL statement These bind variables are nothing but run time query parameters The values in the SQL statement are bound at run time when we use bind variables m
 

Microsoft AJAX Library - Functions as Variables

Functions as Variables In JavaScript functions are first class objects This means that a function is regarded as a data type whose values can be saved in local variables passed as parameters and so on For example when defining a function you can assign it to a variable and then call the function thr
 

C++ Function Passing Types

C Function Passing Types In this C tutorial you will learn about function passing types two types of arguments passing in functions passed by value  and  passed by reference are discussed here mosgoogle center The arguments passed to a function can be performed in two ways Passed
 

Swap two variables

How to swap two variables without using third variable? A variable is a named location in memory that is used to store data which can be modified in a program. Let us learn how to swap two variables without using third variable. This can be done in number of ways By using arithmetic operators
 

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won’t get over the line without a polished, prof
 

Mainframe Features

Mainframe Features In this Mainframe tutorial you will learn about features of Mainframe Processing power memory capacity performance computing multiple operating system time sharing reliability serviceability availability clustering technology and other features available in Mainframe mosgoogle cen
 

Importance of Proper English during Job Interview

Importance of Proper English during Job Interview Your job interview is crucially important and it will determine whether or not you will get the job Depending on the type of job you re going for it is very important for you to use proper English In most cases jobs which offer higher salaries will h
 

Passing values to JavaScript Function

Passing values to JavaScript Function In this JavaScript Tutorial you will learn about how to pass values to and also how to return values from a JavaScript function mosgoogle center Passing Values to function Values can be passed to a function as parameters The general syntax for passing values to
 

Ways to keep conversation going

Ways to keep conversation going Have you had a really good conversation lately A conversation requires skills in speaking and listening Therefore to have a good conversation you must be both a good speaker and listener mosgoogle Listening is very simple especially if you are interested with the pers
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape