Is there a way to store variable outside the code?

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
Sandrit
Member
Posts: 6
Joined: Fri Sep 11, 2015 11:06 pm

Is there a way to store variable outside the code?

Post by Sandrit » Mon Oct 05, 2015 1:19 am

Code: Select all

COMPUTE K215-SUM = K215-FIRST – K215-SECOND

IF K215-SUM < 100 AND K100-ACCOUNT-NO = 110 OR 118 OR 120 OR 125 OR 130 OR 132 OR 136 OR 140 OR 148 OR 150 OR 155 OR 156 OR 160 OR 165 OR 168 OR 171 OR 172 OR 175 OR 176 OR 180 OR 185

  MOVE 'Account exist' TO K110-STATE 
ELSE 
STRING K215-SUM
                  ' To capital accout' INTO K110-MESSAGE-TEXT
END-IF.
It there a way to store the account numbers “K100-ACCOUNT-NO” somewhere outside the code?

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Mon Oct 05, 2015 11:13 am

If you mean "that big list of literals, so that they don't make the code ugly and more difficult to maintain", then yes.

Code: Select all

05  K100-ACCOUNT-NO PIC 9&#40;3&#41;.
    88  K100-ACCOUNT-IS-CLIENT VALUE 110 118 120 125 130 132 136 140 148 150 155 156 160 165 168 171 172 175 176 180 185.
You can make the condition-name (that's what an 88 is) more meaningful (I guessed).

You could also make K100-ACCOUNT-NO a PIC X(3), it does not need to be numeric just because it has numbers in.

You can put the 88 into a copybook of its own, to use it in multiple places without retrying (copybooks can be nested).
Last edited by William Collins on Wed Oct 07, 2015 3:51 pm, edited 1 time in total.

vikriih
Member
Posts: 6
Joined: Sat Oct 24, 2015 2:28 pm

Post by vikriih » Mon Oct 26, 2015 12:47 pm

If you mean outside the program then you can use a sequential file
if you mean outside the procedure division use the 88 level

wijnaldumwilliam
Member
Posts: 1
Joined: Wed Dec 30, 2015 4:52 pm
Contact:

Post by wijnaldumwilliam » Wed Dec 30, 2015 4:56 pm

It is possible to edit the clipboard and our forum member Prino has provided a macro to do so. Search for it if you are interested. However, IMHO, copying stem variables to clipboard will be a convoluted way to achieve what you are trying to do.

/* Rexx */
/*********************************************************************/
/* */
/* Written Heisei 25.07.09 by Akatsukami-sama. */
/* */
/*********************************************************************/
ADDRESS ISREDIT "MACRO (DSN)"
trace o
sig = x2c("E69989A3A3859540C88589A2858940F2F54BF0F74BF0F940")
sig = sig || x2c("82A840C19281A3A2A49281948960A2819481")
"ALLOC FI(FO) DA('"dsn"') SHR"
"EXECIO * DISKR FO (STEM STEM. FINIS"
"FREE FI(FO)"
address isredit "(L1) = CURSOR"

do i = 1 to stem.0
address isredit "LINE_AFTER &L1 = '"stem.i"'"
l1 = l1 + 1
end

exit

academyindia4

Topic deleted by Admin

Post by academyindia4 » Fri Jan 15, 2016 8:26 pm

<< Content deleted By Admin >>

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others