Вы находитесь на странице: 1из 16

c  


   

 


c   

  


c   
   

 


RE: How to edit comp-3 variable in cobol?

ae cant move the variable of type S9(10)V99 COMP-3 to ALPHANUMERIC directly.


Plz declare a intermediate variable of type +9(10).99 and move it to the alphanumeric.. It works.

In your case if we take the exmaple of date and define the variable as
"WS-DATE PIC 9(8) COMP-3 VALUE 20101010."
"WS-DATE-TEMP PIC 9(8)."

Then we need to move WS-DATE to WS-DATE-TEMP

"MOVE aS-DATE TO aS-DATE-TEMP."

Then if you want the date in DD-MM-YYYY format then define the group variables as below

01 WS-DATE-TEMP1.
05 WS-TEMP-YYYY PIC 9(4).
05 WS-TEMP-MM PIC 9(2).
05 WS-TEMP-DD PIC 9(2).

01 WS-DATE-FORMAT.
05 WS-DD PIC X(2).
05 FILLER PIC X(1) VALUE '-'
05 WS-MM PIC X(2).
05 FILLER PIC X(1) VALUE '-'
05 WS-YYYY PIC X(4).

Then...

MOVE aS-DATE-TEMP TO aS-DATE-TEMP1"


MOVE aS-TEMP-YYYY TO aS-YYYY.
MOVE aS-TEMP-MM TO aS-MM.
MOVE aS-TEMP-DD TO aS-DD.

DISPLAY "WS-YYYY-" WS-YYYY.


DISPLAY "WS-MM-" WS-MM.
DISPLAY "WS-DD-" WS-DD.
DISPLAY "WS-DATE-FORMAT-" WS-DATE-FORMAT.

WS-DATE-FORMAT will have the date in desired format like "10-10-2010"

RE: INSEPCT

INSPECT is to check a string for character comparison.


c   
   

 

† Inspect statement is used to examine the contents of a variable for the occurence of a Character/String.
† Inspect statement with tallying is used to count the no. of occurences of such character.
† Inspect statement with replacing is used to replace the string/character by another string/character.

-> Inspect is used to count the number of characters in a string.


-> Inspect is used for replacing the string of characters.
-> It is also used for converting the string of characters.

Let us see examples for above 3 cases.


Eg1:
01 ws-count pic 9(2).
01 ws-cobol pic x(16) value 'this is srinivas'.
procedure division.
Inspect ws-cobol tallying ws-count for all 'i'.
display ws-count.
stop run.
// here we will get output 4.

Eg2:
Inspect ws-cobol Replacing all 'i' by 's'.
display ws-cobol.
stop run.
// here we will get out put 'thss ss srsnsvas'.

Eg3:
Inspect converting 'this is srinivas' to 'THIS IS SRINIVAS' .
// here we will get output as THIS IS SRINIVAS.

RE: ahat is Load module & Link edit and How will it work Dynamic call?

Load Module: The object code converted into Load Module (Machine readable form) by using Link edit that's common in
COBOL.

But in Dynamic call first we have to submit the sub progs later we can use that in Link section in COBCOMP. That's the
procedure. To run the cobol program first it go through compiler to get object code which will go through LINK EDIT to
produce Load module which would be a executable code. For the Dynmic calls both calling and called programs are
compiled and linkedited separately to produce the load modules but we have to use dynam compiler option while
compiling the main pgm.

File Concept
The Disposition Parameter in the JCL is Share ( DISP=SHR ) and Cobol program opens file in " Extend " mode. In this
scenarion what will happen to that file?

The DISP SHR in JCL means that the file is already existing and that it is not exclusively locked for your own use. Other
user can still access this file. And the EXTEND in the COBOL program means that when you open the file the record
pointer will be positioned on the last row of the record and every insert you'll make will be appended on the last position
of the file.

RE: How COBOL FLAT files(Index,Sequential) are very secure for huge data?If not, How will you migrate with any
Database with Frond end COBOL?
c   
   

 


Well if you are using flat file you have advantage as well as disadvantages.
Advantage -It is Secure Physically edited.
Disadvantage - Logically speaking performance is slow difficult to find the particular record.
RE: How will work GOBACK statement & STOP RUN & EXIT-PROGRAM in COBOL ?

STOP RUN: IT terminates the current program.

GO Back: When we apply in place of stop run the loop will be continued infinately.

Exit: It's a optional one for paragraphs we can apply this one.

Eg: Para
--------
--------
Exit-para. 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.

RE: Impact Analysis

Output file being used where is it being used is it going to some downstream systems needs to be identified.
Check the copybook for the fillers if it can be reused. if not then adding the new fields needs to be checked to see what all
procs or jobs use it and LRECL needs to be changed.

The impacted jobs where this input file needs to be added.


Where this source program is being used what all jobs are using it.

Where the copybook is used needs to be recompiled. First of all - it needs to be understood what the program is used for.
Questions like

i) why the new file is being introduced to the program?

ii) adding extra two columns to the output file - will that impact the other programs which might be using that file?

ii) is there any user interface linked to the program?

iii) if yes how frequently that interface is used and will there be any change in that interface?

iv) if program is used for any reporting etc will there by any changes to the hard copy reports spool settings etc.

v) the two extra columns - can they be accommodated with the existing LRECL of the output file or will that need to be
reconsidered.

should be answered and the changes should be conside


ans-2 Impact Analysis:
If a change requested to an existing process need to analyse the impact on entities

Interview Purpose
-----------------
Requirement - Size of a field need to be increased in a copybook

Before giving estimation to above requirement we need to do impact analysis


c   
   

 


1. Validate the changes required to the copybook


- If FILLER (unused space) exist use that space to increase above field. This will save from increasing copybook length
- If no FILLER exist in copybook increase field length which will increase copybook length
2. Search for Programs used this copybook. Analyse the usage of field in these programs. If the field value is moving to any
working storage field start analyse the impact of that working storage variable
- If the program is a sub-program validate if this field moving to main program through linkage section variable
3. Validate the files linked to the copybook
4. If the filed value is moving to any database then validate DCLGEN
5. If the value moving to any online programs analyse if it requires any changes to online screen
COPY Statement
Which one of the following COPY statement is correct?1) COPY COPYFILE REPLACE ==PRE-== ==WK-==2) COPY
COPYFILE REPLACING =PRE-= =WK-=3) COPY COPYFILE SUPPRESS4) COPY REPLACING ==PRE-== ==WK-== IN
COPYFILE5)
Latest Answer: Correct answer is: 2) COPY COPYFILE REPLACING =PRE-= =WK-= ...
RE: INSPECT and EXAMINE

Inspect will inspect leading space and special characters ..Examine will check for spaces even in between statements.
Inspect and examine both perform the same function's.Only difference is that Inspect is far more powerful than Examine
and the latter has been removed from later versions of COBOL.

Piece Of Advice-----before putting up anything and everything regarding mainframe why dont you first try googling :)

RE: Give simple program example for Dynamic link and Dynamic call in COBOL?

Static Call In Cobol:

Is calling of a literal.

CALL 'ABC' USING ARGUMENTS

The call statement specifies the sub-routine called as a literal. i.e within quotes 'ABC'.
In static calls if ABC is modified and recompiled then all the executables calling ABC should be relinked.

Dynamic Calls:

01 Sub-Routine pic x(8) value 'ABC'

CALL ABC USING ARGUMENTS

Dynamic calling invovles calling a sub-routine using a variable and the variable contains the sub-routine name.
here the complied code is loaded when needed and is not incorporated into the executable.

Usually in COBOL the subroutines are compiled and linked to the load module at the time of compilation and if we are
calling the subroutine only a few times then may not worth keeping in the memory unnecessary. This is known as STATIC
CALL. So COBOL facilitates another mechanism called DYNAMIC CALLs to avoid this prob. In dyanamic call the subroutine
is not a component of the main program. It is compiled separately and is only moved to main memory at the time of
CALLing. Hence it saves memory and overhead. Dynamic Calls:

01 Sub-Routine pic x(8) value 'ABC'

CALL Sub-Routine USING ARGUMENTS


RE: How will you connect any Database to MicroFocus COBOL?

From Microfocus COBOL you cannot connect to database. You need to 'CALL' any Pro-Cobol program which is coded with
EXEC-SQL END-EXEC statement within it by giving the appropriate Call-Code's(read write etc) Table name etc.
c   
   

 

RE: How do you delete specific record using COBOL

Why all of discussing as it's not possible. In VSAM we also having KSDS file. In that everyfile stored in Sequence numbers i
mean Primary key values. First we have to move 50 to key number and apply delete syntax........... Simple. The file which we
are using is VSAm file then we can go for Key mentioned ,
If it is a sequential file we have to read till the 49th record then needs to delete the 50th record, this is the main
disadvantage with Sequential files.

RE: in-line PERFORM and out-line PERFORM

In-line PERFORM have explicit scope terminator END-PERFORM where as Out-line PERFORM does not. Out-line perform
have paragraphs.
If you want to perform certain amount of code only one time in the program then we use in-line PERFORM.
If you want to perform the same code many times within the program then you put that code in a paragraph and use it
wherever you want. IN-LINE PERFORM:

PERFORM .............
.............
.............
END-PERFORM.

The statements which are under Scope perform is called IN-LINE PERFORM.

OUT-LINE PERFORM:

Other than any other perform is called Outline perform.

1) Normal perform
2) Perform para n times
3) Perform para varying
4) Perform Para thru

RE: Comp and Comp-3

Comp-3 is more efficient than Comp.

Comp: Binary representation of data can contain only S 9


1 - 4 : 2 bytes (1/2 word)
5 - 9 : 4 bytes (Full word)
10 -18 : Doubleword

Comp-3 : Packed decimal representation two digits are stored in each byte.
n/2 + 1

Comp-3 fails at word boundaries. In this case comp is the best.


Example - 9(4)
COMP-3 : 4/2 + 1 3 Bytes
COMP : 2 Bytes
so in this case at word boundaries use Comp

RE: comp-3

COMP-3 is a computational method used in COBOL. COMP-3 is represented in Packed Decimail format. Decimails are
alloed to this COMP-3 Field.
Each digit occupies 1/2 bite of memory so this declaration is useful and it conserves the memory.
c   
   

 

Ex: 01 A PIC S9(5) COMP-3

A will occupy 5/2+1/2(Sign) 3 Bytes of memory. other than the boundary values(4 9 18) COMP-3 will conserve the
memory space.

RE: COBOL dynamic call and static call

Static Call:
1. in COBOL if you Code a call statement as fooliows is a static call.
CALL 'Pgm1' Using Var1 Var2 ...
2. Compiler option for Static call is NODYNAM
3. Calling Program and Called program loads are available in same loadmoduale.
4. It occupies more Real memory due to all loadmodules are available in real memory.
5. Processing will be Fast due to all programs loads are available in memory.

Dynamic Call:
2. If you write a Call statement by using Call leterals this type of call is called as Dynamic call as follows.
CALL WS-PGM1 Using Var1 Var2 ...
2. Compiler Option for Dynamic call is DYNAM.
3. Called program and calling program will be available in separate loads.
4. On Execution Program will occupy less memory due to only active program load will be loaded in the real memory.
5. Processing speed will be slow compare with Static call. because main program calling Subprogram then main program
will be replaced with subprogram in the memory and once sub program finishes execution again main program will be
loaded so loading and unloading will decrease speed of execution.
RE: aorking Storage Definition

Hi

This is not a Valid definition bcz the USAGE IS INDEX clause is used to provide an optimized table subscript. When a table
is the target of a SEARCH statement it must have an associated index item.
Any item declared with USAGE IS INDEX can only appear in:
- A SEARCH or SET statement
- A relation condition
- The USING phrase of the PROCEDURE DIVISION
- The USING phrase of the CALL statement

RE: ahat is zonal decimal in Cobol?

Zonal decimal is nothing but our simple declaration. Simple declaration means each digits count as a bytes.
For exaple. 77 A pic 99. Now A is 2 bytes(99(2 digits) counts 2 bytes
compare:
77 A pic 9(4) comp > A has 2 bytes.
77 A pic 9(4) > A has 4 bytes---------------> this is called zonal decimal
RE: How to find the number of records in a flat file using COBOL ?

The above answers are ok; i'm giving it in a simplified way: The complete program follows:
††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††††
ID DIVISION.
PROGRAM-ID. ABC.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
c   
   

 

SELECT INFILE ASSIGN TO DD1
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE-STATUS IS FS1.
DATA DIVISION.
FILE SECTION.
FD INFILE.
01 INREC PIC X(80).
aORKING-STORAGE SECTION.
77 I PIC 9(4).
77 EOF PIC X(3) VALUE 'NO'.
PROCEDURE DIVISION.
OPEN INPUT INFILE.
DISPLAY 'OPEN INFILE ' FS1.
PERFORM UNTIL EOF 'YES'
READ INFILE
AT END MOVE 'YES' TO EOF
NOT AT END
ADD 1 TO I
END-PERFORM.
DISPLAY 'THE NUMBER OF RECORDS IN THE FILE ARE ' I.
CLOSE INFILE.
DISPLAY 'CLOSE FILE ' FS1.
STOP RUN.

RE: ahat is the difference between call by context and call by reference?

Call by content : If we change formal arguments (variables used in sub program) their corresponding actual arguments
(variables used in main) will not be changed.
ex ) CALL 'subprg' USING BY CONTENT A B C.

Call by reference : If we change formal arguments (variables used in sub program) their corresponding actual arguments
(variables used in main) will also be changed.
Call by reference is default.
ex ) CALL 'subprg' USING BY REFERENCE A B C.
(OR)
CALL 'subprg' USING A B C.
RE: How can you redefine pic x(10) with pic 9(10) without loosing the existing data from the record.

It gives the ERROR SOC7.

RE: Is zero suppression possible on an alphanumeric wo...

Yes by using INSPECT eg. INSPECT variable REPLACING LEADING ZEROS BY SPACES.

RE: ahat is Linkage Section? Can we use this concept w...

The linkage section is a way to obtain address to storage areas outside your program. Typically we think the data passed
by a main/calling program. But the Linkage Section can also be used to access PARM data from JCL or in CICS/DB2 to
access system information. (Keeping in mind these programs are really subprograms to CICS and /or DB2). Finally you
could be passed an address by another routine (i.e. a called C or C++ function) and then use COBOL's SET POINTER to
reference the storage at the passed address.
c   
   

 

RE: what is the difference between the 'call by value'...

Call by reference :
- address of the parameters will be passed to the sub-program. Changes to the parameter in the called program affect the
corresponding argument in the calling program.
Default is call by reference

Call by value:

-only the copy of the contents will be passed to the sub-program.The called program cannot change the value of this
parameter as referenced in the CALL statement's USING phrase.

Call by value:

This is default in cobol no need to specify the call by value. The changes to the variable in the called program in reflected
back in the calling program.

Call by content:

This should be specified along with call and here the content of the variable is passed to the called program but the
changes in the called programwill not be relected in the calling program.

RE: how do you encrypt passwords in MainFrames

ans: ACCEPT PASSWORD WITH NO ECHO.


With this clause the password is encrypted
RE: what is the diffrence between endeavor and changeman?

change man cost more for company but time less.


Endeavor saves money more but takes time to execute job more.

RE: ahat is Addressing mode

AMODE is addressing mode.AMODE can be 24 31 or any. AMODE 24 implies that the addresses below the 16Meg line can
be fetched but the addresses below the 16 Meg line cannot be fetched. AMODE 31 implies that the addresses above and
below the 16Meg line can be fetched. All new codes in COBOL 3 have amode as 31 by default.Hope this helps!!

Addressing Mode tells which hardware addressing mode is supported by your program:

There are two TYPES of modeS in our community.

AMODE- Addressing Mode

24bit addressing 31-bit addressing or either 24-bit or 31-bit addressing. This attribute is AMODE 24 AMODE 31 or
AMODE ANY.

RMODE- Residency Mode

24bit addressing 31-bit addressing or either 24-bit or 31-bit addressing. This attribute is RMODE 24 RMODE 31 or
RMODE ANY.

Note that First of the COBOL supported only 24 bit addressing Mode.
RE: ahat will happen if we give GOBACK statement inste...

Stop run: Terminates the execution of the program and return back to the OS
c   
   

 

GOBACK: Terminates the execution of the program and return back to the previous higher level.

If you give goback instead of stoprun in a standalone program nothing will happen. goback is going to return back to the
OS since that is the higher level for the program.

RE: arite sample program to read a file randomly i.e a...

If a file must be read randomly then it must either be a relative file or a direct file. In either cases we make use of
a key.(relative key or a record key to access records).
steps to read a file randomly.
1. Have a file which is defined to be accessed in a random way in the IO Section and have a field (In case of
indexed files the key must be a part of the record.In case of a relative file the key must be from the aorking
Storage Section).
2. In Procedure Division Open the I/P file.
3.To assign values to the key we can do any of the foll.
a) ACCEPT the value from the user and MOVE it to the keyfield.
b) Assign any values directly to the keyfield using MOVE.
4. READ filename RECORD
INVALID KEY GOTO ERROR-PARA. (or something like that)
5.Steps 3 to 4 must be put in a loop to read more than one record.
NOTE:
1)Only those records whose keyfields are present in the I/P file (Indexed file) can be accessed else READ will be
unsuccessful.
2)In case of Relative files Relative record no starts from 1 to 65536(or something) depending on the no of
records present in the I/P file.

RE: How data names with comp1 usage is stored in memor...

USAGE COMP-1 : Data is stored as single precision floating point in 4 bytes.Difference between COMP-1 COMP-2 COMP-3
and COMP :COMP-1 data is stored as single precision floating point using 4 bytes of memory.COMP-2 data is stored as
double-precision floating point using 8 bytes of memory.COMP-3 data is stored in Packed Decimal format. The number of
bytes occupied depends on the size of the field specified in the PICTURE clause.The formula for finding the number of
bytes needed to store the data is INTEGER((n/2) + 1) where 'n' is the size of the field. (Note: If SIGN SEPARATE clause is
specified one more byte is needed to store the sign).COMP : data is stored in binary format.For USAGE COMP-1 or USAGE
COMP-2 picture clause is not to be given whereas for COMP and COMP-3 picture clause is to be given.

RE: State difference between reading a file by using start command and reading a file using the key value? (Both
are in dynamic access mode)

Actually the START command does not READ anything. It simply sets the location pointer to the file for a subsequent
READ command.

For random reading the key of the desired record (or part of the key) must be supplied which causes the specific record
which matches(in the case of READ EQUAL TO) to be retrieved. Unless the key is changed subsequent READ's would
return the same record repeatedly.

In cases where a group of records (but not the whole file) need to be read sequentially the START statement is used to
position the file pointer to the 1st record to be read. Subsequent READ NEXT statements will then read sequentially from
that point.

In dynamic mode START is optional and the same result can be accomplished by using a direct READ by key to retrieve
the 1st record of the set followed by READ NEXT statements to retrieve subsequent records.

RE: how to pass the parameter in PARM using LINKAGE Section syntax...
c   
   

 

the syntax for passing values is

//step1 exec pgm 'pgm1' parm 'x y z'

this is simple jcl code

and the corresponding cobol for this is

linkage section

01 parmval

05 parmval-len pic s9(4)

05 parmval-txt pic(100)

procedure division using parmval

this is the corresponding cobol code

RE: ae have two files. and we want to write the matchi...

sort the two files in assecding order.. with maching sequence take one file as master file and read the master file first and
read the other file for matching compare the maching value

if machval1 > machval2

read next of machfile2

if machval1 < machfval2

read next of Machfile1

if machval2 matchval2

write into 3 fileread next of both file1 file2 and reapeat the para again..

RE: what are function use in cobol ?

An | | |  | is a function that performs a mathematical character or logical operation and thereby allows you to
make reference to a data item whose value is derived automatically during execution.
The functions can be grouped into six categories based on the type of service performed:

¦ Mathematical

¦ Statistical

¦ Date/time

¦ Financial

¦ Character-handling
c   
   

 


¦ General

You can reference a function by specifying its name along with any required arguments in a procedure division statement.

RE: ahat is the use of Level 49 in COBOL?

You "need" 49 levels to define host variables for VARCHAR cols in DB2. The 1st 49 contains the length of the string; the
2nd the string itself. To move the string you can use refmod or the STRING stmt eg.:
Code:

01 varchar-fld.
49 vf-len pic s9(004) comp.
49 vf-data pic x(00n).

move vf-data(1:vf-len) to ....


PS It's the creator's responsibility to populate vf-len when vf-data is populated. When the data is written to the DB2 table
it will only occupy as many bytes as the vf-len indicates even though the PIC of the host variable may be larger.

Also note that there is no "space" fill when the col is loaded into vf-data. If vf-data was 5 bytes and conained "AAAAA" then
you loaded the col containing "BB" the result would be "BBAAA"

RE: In which situation condition 88 variable used,give...

whenever u find single variable with multiple conditions u can go for 88 level number.ex. marks 0 to 34 fail 35 to 49 third
class 50 to 59 second class 60 to 69 first class 70 and above distinction. can be codded using 88 level no. as w-s section. 88
fail value 0 thru 34. 88 third value 35 thru 49. 88 second value 50 thru 59. 88 first value 60 thru 69. 88 distinction value
70 thru 100. 88 notvalid value 100 and above.

Level-88 describes condition-names.When the string's values are foreseeable and it's long or unreadable and the string
would be used in many places you could use level-88 string to make the evaluate process more easier and
understandable.

For example: for the variable string ws-sex there should be two condition one is M for male the other is F for female . we
can define that

05 ws-sex pic x(01).

88 ws-sex-male value M .

88 ws-sex-female value F .

It is clear that the sentence set ws-sex-male to true is much understandable than move M to ws-sex .

It is more obvious when the condition is more.


RE: ahat is the difference between static & dynamic call?

A statically called program is link-edited into the same load module as the calling program a static call is faster than a
dynamic call. A static call is the preferred method if your application does not require the services of the dynamic call.

Statically called programs cannot be deleted (using CANCEL) so static calls might take more main storage. If storage is a
concern think about using dynamic calls. Regardless of whether it is called a statically called program is loaded into
storage; a dynamically called program is loaded only when it is called.
c   
   

 


RE: Can we reverse the string in cobol ? See the follo...

Hi

we can reverse the string using cobol prog like this :

IDENTIFICATION DIVISION.
PROGRAM-ID. MID.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 STR1 PIC X(7) VALUE IS 'MANOJ'.
01 STR2 PIC X(1).
01 STR3 PIC X(7) VALUE SPACE.
†01 STR4 PIC X(7).
01 STRLEN PIC 9(1).
01 CTR1 PIC 9(1) VALUE IS 1.
PROCEDURE DIVISION.
INSPECT STR1 TALLYING STRLEN FOR CHARACTERS.
DISPLAY STRLEN.
PERFORM UNTIL STRLEN < 1

MOVE STR1(STRLEN:1) TO STR2


DISPLAY STR2
STRING
STR3 DELIMITED BY SPACE
STR2 DELIMITED BY SPACE
INTO STR3
COMPUTE STRLEN STRLEN - 1
DISPLAY STR3
END-PERFORM.
DISPLAY STR3.
STOP RUN.

use COBOL intrinsic functionm:FUNCTION REVERSE('MANOJ') ... This should do the tric
1) Is more than one record description is allowed in a FD?2) Is NUMERIC EDIT fields can be used for
1) Is more than one record description is allowed in a FD?2) Is NUMERIC EDIT fields can be used for Arithmatic
operations?3) Is COMPUTE P,Q,W = A+ B/C -E †† 2 is a valid statement?4) Is LINKAGE SECTION is mandatory in a sub
program?5) In edit fiels the character used for check protection is __________6) COMP-2 occupies _________ bytes?7)
Maximum length of a numeric item ________ ?
1. Yes allowed. why because only one file description is allowed in a FD but file is a collection of records.
6. comp-2 occupies 8 bytes .
7. Max length of a numeric item 18 digits.
RE: I want to copy the first and last record from the sequential file in efficient manner?...

hi friend i have a solution for ur pbmplz go trg the jclfirst count the no of records for example if u have 1000 records and
first u split those reccords form the input file 1)which contains the first record 2)contains the last record and concadinate
those records

//TEDIACK1 JOB (AO13TSO0) 'TEDIACK1 ' MSGLEVEL (1 1) // //STEPR020 EXEC PGM SORT //†††††††††††††
† //SYSOUT DD SYSOUT † //SORTIN DD
DSN IRFSD1.IGF.IRFS.OI.ALLINV.JAN0607 DISP SHR //SORTOUT DD DSN IRFSD1.IGF.IRFS.OI.ALLINV.JAN0607.BKUP2 //
UNIT SYSDA SPACE (CYL (100 25) RLSE ROUND)
// DCB (LRECL 1650 BLKSIZE 23100 RECFM FB)
c   
   

 

// DISP ( CATLG DELETE)
//SYSIN DD † SORT FIELDS COPY SKIPREC 999 (or) stopaft 001/†
skiprec will skip the 999 records and the out dataset will have only the last record stopaft 001 will have only the first
record how write another step to concadinate those recordsregards Guru

RE: Can we fetch/ select in working section variables directly without using the host variables?

yes we can as far as we declare the working storage variables in the same way as host variables.
RE: ahat is RESIDENT progamme

A RESIDENT program is one that is loaded into the CICS cashe. This will improve the performance of the application by
not having to re-load them into memory.

COBOL | Question 2 of 166 Print


Ques---What is an explicit scope terminator?

A scope terminator brackets its preceding verb, eg. IF .. END-IF, so that all statements between the verb and its scope
terminator are grouped together. Other common COBOL II verbs are READ, PERFORM, EVALUATE, SEARCH and STRING.

RE: ahat is the difference between NEXT SENTENCE and CONTINUE?

CONTINUE: Whatever the sentences we have first it will focus on the Scope terminators or any conditions then only it will
do other.

NEXT: How many controls we had but it will focus only where is the next step after the Period (.).
Next sentence: The sentence is the collection of statements and is always end with period(.).so next sentence means the
control passes to next sentence after period.
e.g.: if X 3

Compute X X-3
Next sentence
End-if
move X to Y.
move 10 to Y.

Then output is: move 10 to Y.


Continue: Transfer the control after the end scope terminator.
E.g: in above example if we use continue in place of next sentence
output is: move X to Y.

According to this code


If "Next sentence" is given the control wil go to the statement after "ADD +1 TO INPUT-COUNT"(control will go to verb
following the next period).

If "continue "is given control will go to this statement "ADD +1 TO INPUT-COUNT"


(control will go to the next verb after the Explicit scope terminator that is after end-if).

A scope terminator brackets its preceding verb eg. IF .. END-IF so that all statements between the verb and its scope
terminator are grouped together. Other common COBOL II verbs are READ PERFORM EVALUATE SEARCH and STRING.

RE: ahat is the difference between a subscript and an index in a table definition?
c   
   

 

An Index is the value of OFFSET or DISPLACEMENT from the starting of the array. The index is defined as part of the
occurs clause in the definition of the array as shown below.

01 WS-TABLE-ARRAY.
02 WS-TEMP-ARRAY OCCURS 20 TIMES INDEXED BY WS-INDX.
05 WS-TEMP-1 PIC X(01) value spaces.
05 WS-TEMP-2 PIC X(02) value spaces.

†Note : WS-INDX is the index in this case.

The processing of an INDEX is much faster than the usage of a subscript.

The SET command can be used on an INDEX.

An subscript is the occurance of the element in the table and the subscript is declared explicitly as a working storage
variable. The processing time for subscript is more.
A subscript is a working storage data definition item, typically a PIC (999) where a value must be moved to the subscript
and then incremented or decremented by ADD TO and SUBTRACT FROM statements. An index is a register item that
exists outside the program's working storage. You SET an index to a value and SET it UP BY value and DOWN BY value.

What is LENGTH in COBOL II?


LENGTH acts like a special register to tell the length of a group or elementary item.
Latest Answer: Length is an Intrinsic function in Cobol which returns number of characters in any variable. ...
What is the difference between a binary search and a sequential search? What are the pertinent COBOL
What is the difference between a binary search and a sequential search? What are the pertinent COBOL commands?
In a binary search the table element key values must be in ascending or descending sequence. The table is 'halved' to
search for equal to, greater than or less than conditions until the element is found. In a sequential search the table is
searched from top to bottom, so (ironically) the elements do not have to be in a specific sequence. The binary search is
much faster for larger tables, while sequential works well with smaller ones. SEARCH ALL is used for binary searches;
SEARCH for sequential.
What is the point of the REPLACING option of a copy statement?
REPLACING allows for the same copy to be used more than once in the same code by changing the replace value

RE: ahat is difference between comp & comp-4?

For all of you out who have not hea ab 


Wake 
C
e ex| a  | | j l|ke 
|e | | a hal 
(2 bye

Th| |h hel


he  y h ae  e ab 
|el

COMP hal  1  2bye 5  9 bye 10  18 8 bye


COMP 1 | le  bye
COMP 2 ble  8 bye
COMP  (e 2 +1 hee le h  |el
COMP hal  a e a COMP  omp refers to binary representation which occupies half word(16bits) or full
word(32bits) and Comp-3 refers to packed decimal representation where one digit occupies half a byte ie a nibble and the
sign is stored as the rightmost half -a -byte. C or F represents the positive sign and D represents the negative sigh in
hexadecimal format.
What is the maximum size of the variable length record?

Latest Answer: It is 32767, irrespective of VSAM or non VSAM. In case of VSAM you will have to give no SPANNED while
DELETE-Defining the cluster. IF any doubts you can verify creating in mainframes
Explain call by context by comparing it to other calls?
The parameters passed in a call by context are protected from modification by the called program. In a normal call they
are able to be modified.
c   
   

 

Latest Answer: When during the Call the shared data is moved to the temporary work area, which is then passed to the
subprogram, intead of the original data. As a result, when control is passed back to the calling program, the value of that
field is not modified.
If you were passing a table via linkage, which is preferable - a subscript or an index?

We can pass subscript by linkage section. index cant. 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 mistake, appreciate the lesson more than others.

COBOL | Question 1 of 166 Print


Ques-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 sup

Вам также может понравиться