cobol

Is it possible to add inline comments in Cobol

不羁岁月 提交于 2019-12-18 06:55:06
问题 Most modern programming languages give a way to add inline comments, generally those that use a newline character to indicate the end of a comment, and an arbitrary delimiter or sequence of tokens to indicate the beginning of a comment, while letting the beginning of the line being an interpreted instruction. In COBOL, while commenting a whole line is well documented (it can be done by putting an asterisk symbol ( * ) in column 7), finding documentation on whether or not you can comment the

How do you generate java~jrecord code for a Cobol copybook

别说谁变了你拦得住时间么 提交于 2019-12-17 06:56:19
问题 How do you use the RecordEditor to Generate Java~JRecord code from a Cobol Copybook to read/write a Binary EBCDIC Mainframe File . This a Question and answer to try an prevent some poor/misleading questions being asked or the answer can be pointed to. 回答1: File Transfer To transfer a Binary file from the Mainframe to Windows / *nix box you must do a Binary Transfer for a very simple reason: the Ebcdic --> Ascii program can not distinguish between binary fields and Text fields. Comp-3 value

为什么不使用Double或Float代表货币?

青春壹個敷衍的年華 提交于 2019-12-16 16:50:31
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 一直有人告诉我,永远 不要 用 double float 型或 float 型代表钱,这一次我向你提出一个问题:为什么? 我敢肯定有一个很好的理由,我根本不知道这是什么。 #1楼 这不是精度问题,也不是精度问题。 这是要满足使用10而不是2进行计算的人们的期望的问题。例如,使用double进行财务计算不会产生数学意义上“错误”的答案,但可以得出答案。而不是财务上的预期。 即使您在输出前的最后一分钟对结果进行四舍五入,您仍然偶尔会使用不符合预期的双精度来获得结果。 使用计算器或手动计算结果,则精确地为1.40 * 165 = 231。 但是,在内部使用双打,在我的编译器/操作系统环境中,它存储为接近230.99999的二进制数字...因此,如果截断该数字,则会得到230而不是231。您可能会认为舍入而不是截断会给出了231的期望结果。是的,但是舍入总是涉及截断。 无论您使用哪种舍入技术,仍然存在像这样的边界条件,当您期望将其舍入时,该边界条件将舍入。 它们非常稀有,经常通过偶然的测试或观察将不会被发现。 您可能必须编写一些代码来搜索示例,这些示例说明结果与预期不符。 假设您想四舍五入到最接近的美分。 这样就得到了最终结果,乘以100,再加上0.5,截断,然后将结果除以100,便可以得到几分钱。

Different results using OCCURS with different compilers

守給你的承諾、 提交于 2019-12-14 02:38:51
问题 I'm attempting to output the following row using DISPLAY and am getting the correct result in Micro Focus COBOL in Visual Studio and the Tutorialspoint COBOL compiler, but something strange when running it on a z/OS Mainframe using IBM's Enterprise COBOL: 01 W05-OUTPUT-ROW. 05 W05-OFFICE-NAME PIC X(13). 05 W05-BENEFIT-ROW OCCURS 5 TIMES. 10 PIC X(2) VALUE SPACES. 10 W05-B-TOTAL PIC ZZ,ZZ9.99 VALUE ZEROS. 05 PIC X(2) VALUE SPACES. 05 W05-OFFICE-TOTAL PIC ZZ,ZZ9.99 VALUE ZEROS. It appears in

Finding Highest , Lowest and the Average in a Cobol program

一世执手 提交于 2019-12-13 10:38:34
问题 I am creating a program that is reading in a file which consists of companies and their information. It is supposed to read all the records in my file then display the companies with a 3.5 rating or higher with their information, then it is to reject companies with a rating lower that 3.5 and then display the highest quote and the lowest quote and then the average among the companies. I am new to Cobol so I am not sure how to find the highest, lowest and the average. I have coded what I

formatting DATE-TIME IN COBOL

删除回忆录丶 提交于 2019-12-13 09:18:10
问题 i want to format the FUNCTION DATE-TIME. What i have is MOVE FUNCTION CURRENT-DATE TO WS-CURRENT-DATE-DATA DISPLAY WS-CURRENT-DATE-DATA and I tried using a filler 01 WS-CURRENT-DATE-DATA. 05 WS-CURRENT-DATE. 10 WS-CURRENT-YEAR PIC 9(04). 10 FILLER PIC X(01) VALUE "-". 10 WS-CURRENT-MONTH PIC 9(02). 10 WS-CURRENT-DAY PIC 9(02). 05 WS-CURRENT-TIME. 10 WS-CURRENT-HOURS PIC 9(02). 10 WS-CURRENT-MINUTE PIC 9(02). 10 WS-CURRENT-SECOND PIC 9(02). 10 WS-CURRENT-MILLISECONDS PIC 9(02). what I get is a

How to form XFD from cobol Data

为君一笑 提交于 2019-12-13 08:58:43
问题 I'll try to redefine the XFD file structure based on below file settings option Anaylsis Result: Max Record length 300 Min record length 61 No of records 466 Blocking factor 1 Preallocation amount 0 Extension amount 1 Compression factor 80 Encrypted ? No Number of keys 4 Primary key has 1 segments key size 13 offset 0 key 02 has 3 segments Duplicates Are allowed Key size 4 offset 4 Key size 40 offset 21 Key size 4 offset 0 Key 03 has 3 segments Duplicates Are allowed Key size 4 offset 4 Key

SUBSTRING for a String Literal in COBOL

烂漫一生 提交于 2019-12-13 08:36:05
问题 Is there anyway to get a SUBSTRING of string literal in COBOL without using a temporary variable? Let's say in the following code: MOVE "HELLO" TO MY-VAR. MOVE MY-VAR(1:3) TO SUB-STR. Is there any way to do the same thing, but without MY-VAR ? EDIT: I did tried following code, but it's failed. MOVE "HELLO"(1:3) TO SUB-STR * COMPILE ERROR 回答1: You can accomplish what you are trying to do by type-laundering the literal through a function. You can then substring, or reference modify, the output

Which is better in terms of performance? “if else” or “Evaluate” statement in COBOL?

心已入冬 提交于 2019-12-13 07:52:27
问题 Which is better in terms of performance ? " if else " or " evaluate " statement in COBOL, when we have lesser conditons to check ? 回答1: It seems we have a doubter as an OP, so here's an example with IBM Enterprise COBOL: 01 A PIC 9. PROCEDURE DIVISION. ACCEPT A IF A EQUAL TO 2 CONTINUE ELSE CONTINUE END-IF EVALUATE A WHEN 2 CONTINUE WHEN OTHER CONTINUE END-EVALUATE And here is the code which is generated. You don't need to know IBM Mainframe Assembler, you just have to note that things are

Decode a Binary Coded Decimal

99封情书 提交于 2019-12-13 05:13:55
问题 I have a field pic X(03) with a date in it as X'160101' format yymmdd. I will like to know how to convert it to pic x(06). So far I tried to move it back to a 9(03) comp and move the 9(03) comp to a 9(06) but it didn't work. How can I do this? 回答1: If you search stackoverflow, you should find the answer (this has already been answered). But Create a fields like (my-date-x holds the date): 03 my-date-x pic x(3). 03 my-date-9 pic 9(6). 03 date-ymdv0 pic 9(6)v9 comp-3. 03 date-x pic x(3)