cobol

What is a Cobol 88-type equivalent in another languages?

陌路散爱 提交于 2019-12-10 15:46:48
问题 I'm learning COBOL now and really liking the 88-type of variables, and I want to know if there are anything like them in another languages (most known languages also, such as C, Objective-C), even using a library. The only thing I can think being similar is using #define booleanResult (variableName==95) But it isn't possible to set boolenResult to true and make variableName assume 95 as value. 回答1: 05 nicely-named-data PIC X. 88 a-meangingful-condition VALUE "A". 88 another-meaingingful

How do I get rid of trailing and embedded spaces in a string?

。_饼干妹妹 提交于 2019-12-10 15:39:13
问题 I am writing a program that converts national and international account numbers into IBAN numbers. To start, I need to form a string: Bank ID + Branch ID + Account Number + ISO Country Code without the trailing spaces that may be present in these fields. But not every account number has the same length, some account numbers have branch identifiers while others don't, so I will always end up with trailing spaces from these fields. My working storage looks something like this: 01 Input-IBAN. 05

Interpreting COMP-3 Packed Decimal Fields into numeric values

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 14:27:38
问题 I am creating an SSIS package to read in unpacked data from a series of copybook files. I am unsure of the correct interpretation of the following field definitions and was hoping someone would know: FIELD-NAME-1 PIC S9(15)V9(3) COMP-3. FIELD-NAME-2 PIC S9(3)V9(8) COMP-3. FIELD-NAME-3 PIC S9(3)V9(6) COMP-3. The data is stored in fixed width text. The data for the above fields has the following lengths: FIELD-NAME-1: 19 FIELD-NAME-2: 11 FIELD-NAME-3: 9 I am unsure how to interpret the decimal

Ubuntu GnuCobol CURRENCY SIGN IS “£” causes compile errors

被刻印的时光 ゝ 提交于 2019-12-10 14:16:30
问题 Using GnuCOBOL 2.2.0 on Ubuntu 18.10. Working through 'Beginning COBOL for Programmers' by Michael Coughlan. GnuCOBOL has been compiling the book's examples without trouble up until Chapter 9, when this program: IDENTIFICATION DIVISION. PROGRAM-ID. Listing9-2. AUTHOR. Michael Coughlan. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. CURRENCY SIGN IS "£". DATA DIVISION. WORKING-STORAGE SECTION. 01 Edit1 PIC £££,££9.99. PROCEDURE DIVISION. Begin. MOVE 12345.95 TO Edit1 DISPLAY

Read STDIN (SYSIN) in COBOL

别说谁变了你拦得住时间么 提交于 2019-12-10 12:50:02
问题 I want to read the lines out of STDIN (aka SYSIN) in COBOL. For now I just want to print them out so that I know I've got them. From everything I'm reading it looks like this should work: IDENTIFICATION DIVISION. PROGRAM-ID. APP. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT SYSIN ASSIGN TO DA-S-SYSIN ORGANIZATION LINE SEQUENTIAL. DATA DIVISION. FILE SECTION. FD SYSIN. 01 ln PIC X(255). 88 EOF VALUE HIGH-VALUES. WORKING-STORAGE SECTION. PROCEDURE DIVISION. OPEN INPUT SYSIN

Xterm terminal and resize code

家住魔仙堡 提交于 2019-12-10 12:02:18
问题 I am in progress of converting a really old 25+ year old application . It sends an escape sequence to make the SCREEN 132 characters wide... However it didnt work and i put the XTERM equilivment that seems to work in most cases.. It is "\x1B[8;50;132t" Although the screen resizes with success there is an issue Here is the code that the COBOL program uses to execute the command pg -f FILETOSHOW using CALL "SYSTEM" USING BY CONTENT DS-REC where DS-REC is the above command.... The problem is

Cobol Read statement format. Can it be redone a different way?

假如想象 提交于 2019-12-10 11:38:00
问题 On this read statement below couldn't it be made into the form of the following? I think personaly it might be easier to understand and read. Basically the read statement is simply reading through a file and making decision on which paragraph performs should be executed. It probably is difficult to see exaclty what the program does but what I was really interested to know was if you can change the read to a different format as listed below. READ DATA-FILE AT END ...do some code NOT AT END ..

compute rounded in cobol

*爱你&永不变心* 提交于 2019-12-10 03:19:30
问题 I am confused with the rounded in the compute function in cobol. Declaration: VAR-A PIC S9(9)V99 COMP-3. VAR-B PIC S9(9)V9(6) COMP-3. Procedure. MOVE +12.08 TO VAR-A. MOVE +6.181657 TO VAR-B. COMPUTE VAR-A ROUNDED = VAR-A + VAR-B. Will the result of VAR-A be 18.27 or 18.26? What would cobol do upon computing? Would it round VAR-B first to the decimal places specified in VAR-A or will cobol add the 2 variables then round them up to the decimal places specified in VAR-A? Any help will be

In Cobol, to test “null or empty” we use “NOT = SPACE [ AND/OR ] LOW-VALUE” ? Which is it?

那年仲夏 提交于 2019-12-10 02:11:56
问题 I am now working in mainframe, in some modules, to test Not null or Empty we see : NOT = SPACE OR LOW-VALUE The chief says that we should do : NOT = SPACE AND LOW-VALUE Which one is it ? Thanks! 回答1: Chief is correct. COBOL is supposed to read something like natural language (this turns out to be just another bad joke). Lets play with the following variables and values: A = 1 B = 2 C = 3 An expression such as: IF A NOT EQUAL B THEN... Is fairly straight forward to understand. One is not equal

Japanese COBOL Code: rules for G literals and identifiers?

↘锁芯ラ 提交于 2019-12-08 16:37:26
问题 We are processing IBMEnterprise Japanese COBOL source code. The rules that describe exactly what is allowed in G type literals, and what are allowed for identifiers are unclear. The IBM manual indicates that a G'....' literal must have a SHIFT-OUT as the first character inside the quotes, and a SHIFT-IN as the last character before the closing quote. Our COBOL lexer "knows" this, but objects to G literals found in real code. Conclusion: the IBM manual is wrong, or we are misreading it. The