FAQ Database Discussion Community


Excel spreadsheet to COBOL program

excel-vba,cobol,mainframe,jcl
I have a task to migrate an Excel Macro(Which basically does screen scraping) to a COBOL program. Problem is that the user wants to give the input in excel format , I am stumped as to how to convert an excel file as a readable input to a TN3270 Mainframe...

Find matched and unmatched records and position of key-word is unknown [closed]

sorting,cobol,mainframe
I have two files FILE1 & FILE2, and lets say both are fixed length of 30 characters. I need to find the records from FILE1 & FILE2 which contain the string 'COBOL', where the position of this key-word is unknown and changes for every record. To be more clear below...

Is there a way I could make a perform not end (like an infinite while loop)?

cobol,opencobol,gnu-cobol
Is there anyway to do this? I want the perform to exit only when a exit statement is executed. If not I want it to keep looping.

Output is wrong

cobol,opencobol
Written my program but I cannot get the right output as needed Below is my code and my input with the output. Also does my procedure program make sense or should I revise it, it seems it makes sense but after looking at different books I'm not sure anymore. FD...

Comparing what's in a variable to text?

cobol,mainframe
I'm attempting to do some data validation and am trying to use an if statement to see if what is in the variable ERROR-FLAG and RECORD-CODE is "NO" and "VC". Example below.. MOVE "NO" TO ERROR-FLAG. MOVE "NO" TO ERROR-FLAG2. IF VEND-NUM = SPACES MOVE "YES" TO ERROR-FLAG MOVE "********"...

Behavior of STRING verb

cobol,mainframe
I am reading a COBOL program file and I am struggling to understand the way the STRING command works in the following example STRING WK-NO-EMP-SGE ',' WK-DT-DEB-PER-FEU-TEM ',' WK-DT-FIN-PER-FEU-TEM DELIMITED BY SIZE INTO UUUUUU-CO-CLE-ERR-DB2 I have three possible understandings of what it does: Either the code concatenate each variables into...

RSA Encryption using PL/SQL or Cobol

sql,oracle,plsql,cobol
I would like to encrypt a String before sending it over to my client. The client has given me a RSA Public Key. There is a 512 bytes of Modulus and 6 bytes of Pub. Exp. (all Hex). Normally I am running Cobol to produce this output file. But I...

What is the difference between a variable-blocked format and a fixed-blocked format?

cobol,mainframe,jcl
I have encountered these terms in a data file definition document for some data that I'm getting from a Mainframe system. I failed to find definitions of these terms in any glossary or Google search - just mentions of them. Can anyone shed some light on the precise meaning of...

Sequentially read a specific record in a file then display it

cobol
INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT MASTER-FILE ASSIGN TO "MASTER-PRODUCT-FILE.DAT" ORGANIZATION IS SEQUENTIAL ACCESS MODE IS SEQUENTIAL. SELECT TRANSACTION-FILE ASSIGN TO "INVENTORY-FILE.DAT" ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- FILE SECTION. FD MASTER-FILE. 01 MASTER-RECORDS. 05 PR-CODE PIC 9(7). 05 PR-NAME PIC X(30). 05 PR-PRICE PIC 9(5)V99. 05 PR-QUANTITY PIC S9(6). FD...

Reading the last record of a file

cobol
I have a COBOL program that requires a transaction number every run of the program. I am planning to get the last transaction number from the file and add 1 to it. The problem is I don't know how to get the last recorded value. IDENTIFICATION DIVISION. PROGRAM-ID. INVENTORY-SYS. AUTHOR....

How is default rounding in divison handled?

rounding,cobol
In COBOL what is the result of COMPUTE RESULT1 = 97 / 100 COMPUTE RESULT2 = 50 / 100 COMPUTE RESULT3 = 32 / 100 COMPUTE RESULT4 = -97 / 100 COMPUTE RESULT5 = -50 / 100 COMPUTE RESULT6 = -32 / 100 When RESULT1/2/3 are: PIC S9(4) PIC S9(4)V9...

What does illegal character in numeric field error concern for Cobol using Unix system?

average,numeric,cobol
How to solve the error: Execution error : file 'prog3.int' error code: 163, pc=177, call=1, seg=0 163 Illegal character in numeric field IDENTIFICATION DIVISION. PROGRAM-ID. prog3. ENVIRONMENT DIVISION. Input-output Section. File-Control. select input-file assign to "/home1/c/a/acsi203/realestate.dat". select output-file assign to "prog3out.dat" organization is line sequential. DATA DIVISION. File Section. FD...

Java mapping for COBOL comp and comp-3 fields

java,db2,cobol
I am invoking DB2 stored procedure created using COBOL from my java application. input macro (type varchar): 01 SP1-INPUTS. 05 FIELD-1 PIC X(03). 05 FIELD-2 PIC S9(09) COMP. 05 FIELD-3 PIC S9(15)V9(02) COMP-3. 05 FIELD-3X REDEFINES FIELD-3 PIC X(09) To test the stored procedure, I know only value for FIELD-1....

CALL arguments (omitted? literal?)

cobol
I have the following COBOL subroutine that accepts a string, a length, and a "boolean" argument. The subroutine displays the string without the trailing blanks. The length is provided in the event that the input string's full length is different than the storage used in the subroutine for the string...

Report with Report Writer duplicating last line

cobol
I find myself sorting an input file, and using a control break to compute some data. We need headers in the control break, the report writer is duplicating the header each time and I can not figure it out for the life of me. The write statement in the break...

Nested perform needs and doesn't need an end-perform

cobol
With this code, I get 16: Perform stmnt not terminated by end-perform 33: syntax error, unexpected end-perform Why is it saying that I need an end-perform and also not need it? identification division. program-id. xxx. * will accept and display a num until 0 is called then * asks to...

Find a word in a line based on next word

java,cobol
I have a file and here is a portion of of the file. The common word in all lines is PIC here and I am able to find out the index of PIC. I am trying to extract the description for each line. Here how can I extract the word...

ODBC ISAM_EOF without any reason

c#,database,odbc,cobol
I have a strange behavior with an ODBC Driver and the underlying COBOL database. The database driver is acuODBC of AcuCorp(now Microfocus), the database itself is a COBOL database. The DSN is a system DSN and works just fine. Via Access/Excel u can read/write data with the DSN successfully. In...

Data validation for file and formatting the output

cobol,mainframe
I'm trying to code a program to determine if different kinds of errors appear in a given file. I'm going to post my entire code, because I honestly have no idea where I'm going wrong here. It's just abending on me. The data validation is 2100-error-checking. IDENTIFICATION DIVISION. PROGRAM-ID. ASSIGNMENT1....

How to test if an item is left justified?

cobol
I can't figure out how to test if a read in item is left justified or not. For example if I have a WORD-IN PIC X(8), how do I create a test that tests if there are any blanks or "b's" read in. Word read in = _____CAT WORD-IN then...

Income Tax Logic Questions

cobol
I'm having some trouble figuring out the logic behind this. I need to display a report calculating balance, interest and principal per month until the balance is zero. As an example, if input is months=12, balance=25000, rate=4.5%, output should look like this: months balance interest principal 1 $25000.00 $93.75 $2,040.71...

Get specific entries from .dat file with COBOL

file-io,cobol
I'm new to COBOL and having trouble to search specific entries in a .dat file. The idea is to search the file for all the records that have a certain code in one of the fields. I've tried to find the answer in google but everywhere I went the answer...

Sequential file output computing GPA

cobol
I need help on some COBOL homework. I've made a few attempts and they don't seem to be working as I would hope. I need to make a program that reads an input file with some student info, then output it to the terminal and an output file. I also...

Pattern for reading a sequential input file

cobol
I've been seeing a lot of examples for reading a sequential file in COBOL that looks something like this: FD File-Record 01 Input-Record. 88 End-Of-File VALUE HIGH-VALUES. 05 ... ... READ File-Record AT END SET End-Of-File TO TRUE END-READ PERFORM UNTIL End-Of-File PERFORM Process-Record READ File-Record AT END SET End-Of-File...

What date/time format is this? COBOL Output

formatting,cobol,date-formatting
I seem to have an issue figuring out what date format a program in COBOL is storing data in. DATE_SCHD A80911 A80911 B00324 A51021 A51028 A60518 B50204 B50204 B50204 B50204 B50206 B50202 B50206 B50210 Any clues?...