There must be a programmatically way to determine which record is which, normally it is done with 1 or more fields, position (e.g. 1st / last record) can be used. JRecord provides several ways of deciding which record to use. The lowest level is a hand written RecordDecider interface. It has one method int getPreferedIndex(AbstractLine line); You are given a JRecord line and return the Record-Index. You can use the setRecordDecider method to assign your method String poDownloadCobolFileName = Data.AMS_PO_COBOL_COPYBOOK_FILE_NAME;...
It's been a while since the last drop of this code happened, so I'm not sure if it's still supported. Today I got a file with multiple record types in it. It seems that the four different record types are supersets of each other - there's a small one, one with some additional fields, another with additional fields on top of that one, etc. - four in total. I've tried concatenating the four copybooks and running the MultiRecordCobol2Csv tool against the records, but it doesn't seem to be able to figure...
I have updated Cobol2Csv to convert Cobol Multi-record file type files to Csv. See https://sourceforge.net/projects/coboltocsv/files/CobolToCsv/Version_0.90/
I am about to do a new Version that supports multi-record files. I will leave the existing programs alone and write a new multi-record Cobol to Csv program. This new program will support: writing each record type in a seperate file Adding the record-name as the first field in the file All the normal options
Here is a java program that reads a multi-record fileand writes a tsv (tab selected values). I used tabs because it is highly unlikely to be any tabs in the Cobol-file. In your case you could: Read all the copybooks into a String variable Create a StringReader for use in the ICobolIOBuilder iob = JRecordInterface1.COBOL.newIOBuilder(copybookName) statment Alternatively you could use the JRecordInterface1.COBOL.newMultiCopybookIOBuilder interface. Anyway here is an example of a program to generate...
If the Copybooks start with 01 then yes but it may not give you what you want. If you have 01 Rec-1. 05 field-1-1 Pic x(2). 05 field-1-2 Pic x(4). 01 Rec-2. 05 field-2-1 Pic x(4). 05 field-2-2 Pic x(1). And the data is 0123456 you will get field-1-1,field-1-2,field-2-1,field-2-2 12,3456,1234,5 Converting Multi-Record files to CSV does not seem very sensible to me and likely to be of very limited appeal
Hi Bruce, If i can concatenete it, i can use the coboltocsv.. is not it? Thanks, Kaushik
No that is Windows command; On the Mainframe: In standard ZOS JCL you could use a SORT Copy On the Unix side you can use standard unix commands //COPY EXEC PGM=SORT //SYSOUT DD SYSOUT=A //SORTIN DD DSN=XXXX.COPYBOOK(COPY1),DISP=SHR // DD DSN=XXXX.COPYBOOK(COPY2),DISP=SHR // DD DSN=XXXX.COPYBOOK(COPY3),DISP=SHR //SORTOUT DD DSN=XXXX.COMBINED.COBOL,DISP=(,CATLG), // UNIT=SYSDA,SPACE=(CYL,(5,5)) //SYSIN DD OPTION COPY / Issue -Cobol2Csv does not support Multiple copybooks Cobol2Cv does not support multiple...
My thought is - if i can concatenete it, i can use the coboltocsv.. is not it?
Are you saying that I can use below command in minframe?- copy file1.cbl + file2.cbl + file3.cbl concattedfile.cbl
Sorry for the delay answering, been distracted. You concatenate files like: copy file1.cbl + file2.cbl + file3.cbl concattedfile.cbl Thinking some more on this Cobol2Csv will not handle multi-record files. Again I would suggest using Cobol2Xml, Cobol2JSon programs instead or generating Java-JRecord Pojo code. Note: I will have a new RecordEditor withan updated CodeGenerator in it. If you still want to convert the file to csv; you are better off starting with the Cobol2Xml package as it handles multi-record...
Could you please tell me the step how I can merge the copybooks using the windows bat options.
Thanks Bruce. I tried but I am not able to merge the copybook so that I can use the existing utility. It will be helpful if you can look at the multiple copybook option. Thanks in Advance.
It can not take multiple copybooks as input; you will have to combine them into one file and use the split option. In bat / shell scripts you have the option of combining the files. I can look at a MultiCopybook option but is low priority at this stage
I still dont understand how this tool can take multiple copybook as input .. As I can see in the screenshot, there is only one copybook.
Also you can generate Java~JRecord code
If it is reasonably easy to determine one record-type from the other you can look at Cobol To Xml there is also a CobolToJson. Notes: Do a binary transfer from the Mainframe If it is VB (it will almost certainly will be) use the RDW option to preserver the Record-Descriptor Word (Record-Length). As a last resort JRecord will use Record-Length to determine the Record-Type. Also the generate option in the RecordEditor may be useful: Start the server (or restart your computer after installing) Start...
If it is reasonably easy to determine one record-type from the other you can look at Cobol To Xml there is also a CobolToJson. Notes: Do a binary transfer from the Mainframe If it is VB (it will almost certainly will be) use the RDW option to preserver the Record-Descriptor Word (Record-Length). As a last resort JRecord will use Record-Length to determine the Record-Type. Also the generate option in the RecordEditor may be useful: Start the server (or restart your computer after installing) Start...
If it is reasonably easy to determine one record-type from the other you can look at Cobol To Xml there is also a CobolToJson. Notes: Do a binary transfer from the Mainframe If it is VB (it will almost certainly will be) use the RDW option to preserver the Record-Descriptor Word (Record-Length). As a last resort JRecord will use Record-Length to determine the Record-Type. Also the generate option in the RecordEditor may be useful: Start the server (or restart your computer after installing) Start...
Hi Bruce Martin, I used your code CoboltoCSV code for getting the readable file of an IMS unload file using one copybook and it's working as expected. However I need your suggestion in the below requirement- I have one IMS unload file. But I have multiple Copybook to see the unload file in Fileaid. In the unload file, there are some parent and child relationship. Could you please tell me how to enhance your code to use this for scenario. This is the below options that I have tried till now- 1. Convert...
Have you tried installing a headless version of java, Most linux distributions offer a headless version of java. I have not tried runningCobol2Csv under headless-java. There should not be any gui stuff
How do I run this on a headless server without X11? What is the requirement for X11?
You are fantastic! It's worked!
Hi Bruce Martin, Hope all is well with you. I have unloaded one IMS segment in a flat file and I have also have a copybook. I need to convert the unloaded flat file in CSV format. I have tried with the CBL2CSV utility but the output is not coming as expected. Could you please help me on this.
The first problem is the you have done a EBCDIC to Ascii conversion on the data file which has corrupted it. The file has comp/comp-3 fields in it. For example the space character x'40' is perfectly valid in a Comp, Comp-3. But the Ebcdic --> Ascii converter will convert all x'40' (EBCDIC space char) to x'20' (Ascii space). It will do this for both text and binary fields. You need to go back to the Mainframe, I would suggest converting the extract file to FB (it is probably VB) Doing a binary transfer...
The first problem is the you have done a EBCDIC to Ascii conversion on the data file which has corrupted it. The file has comp/comp-3 fields in it. For example the space character x'40' is perfectly valid in a Comp, Comp-3. But the Ebcdic --> Ascii converter will convert all x'40' (EBCDIC space char) to x'20' (Ascii space). It will do this for both text and binary fields. You need to go back to the Mainframe, I would suggest converting the extract file to FB (it is probably VB) Doing a binary transfer...
Did you get any chance to look into this?
Hi Bruce Martin, Hope all is well with you. I have unloaded one IMS segment in a flat file and I have also have a copybook. I need to convert the unloaded flat file in CSV format. I have tried with the CBL2CSV utility but the output is not coming as expected. Could you please help me on this.
To create a file with " " as a delimiter use -Delimiter space option. i.e. java -jar ../lib/Cobol2Csv.jar -I In/DTAR020.bin -O Out/o_DTAR020_space.csv -C DTAR020.cbl -Q DoubleQuote -FS Fixed_Length -Delimiter space
need to convert file microfocus cobol isam linux to csv: using syntax: java -jar ../lib/Cobol2Csv.jar -I ES-02 -O ES-02.csv -C FD-MOV.ARQ -D; -FS Fixed_Length does not convert comp fields ~~~cobol 01 REG-MOV-ESTOQUE. 03 CHAVE2-ME. 05 CODIGO-ME PIC 9(5). 05 DATA-ME. 07 ANO-ME PIC 9(4). 07 MES-ME PIC 99. 07 DIA-ME PIC 99. 05 COD-MOV-ME PIC 9(4). 05 CONT-ME PIC 9(3). 03 NF-ME. 05 DATA2-ME. 07 ANO2-ME PIC 9(4). 07 MES2-ME PIC 99. 07 DIA2-ME PIC 99. 05 NR-DOC-ME PIC 9(6). 05 SERIE-ME PIC X(3). 05 TIPO-ME...
need to convert file microfocus cobol isam linux to csv: using syntax: java -jar ../lib/Cobol2Csv.jar -I ES-02 -O ES-02.csv -C FD-MOV.ARQ -D; -FS Fixed_Length does not convert comp fields ~~~cobol 01 REG-MOV-ESTOQUE. 03 CHAVE2-ME. 05 CODIGO-ME PIC 9(5). 05 DATA-ME. 07 ANO-ME PIC 9(4). 07 MES-ME PIC 99. 07 DIA-ME PIC 99. 05 COD-MOV-ME PIC 9(4). 05 CONT-ME PIC 9(3). 03 NF-ME. 05 DATA2-ME. 07 ANO2-ME PIC 9(4). 07 MES2-ME PIC 99. 07 DIA2-ME PIC 99. 05 NR-DOC-ME PIC 9(6). 05 SERIE-ME PIC X(3). 05 TIPO-ME...
need to convert file microfocus cobol isam linux to csv: using syntax: java -jar ../lib/Cobol2Csv.jar -I ES-02 -O ES-02.csv -C FD-MOV.ARQ -D; -FS Fixed_Length does not convert comp fields ~~~cobol 01 REG-MOV-ESTOQUE. 03 CHAVE2-ME. 05 CODIGO-ME PIC 9(5). 05 DATA-ME. 07 ANO-ME PIC 9(4). 07 MES-ME PIC 99. 07 DIA-ME PIC 99. 05 COD-MOV-ME PIC 9(4). 05 CONT-ME PIC 9(3). 03 NF-ME. 05 DATA2-ME. 07 ANO2-ME PIC 9(4). 07 MES2-ME PIC 99. 07 DIA2-ME PIC 99. 05 NR-DOC-ME PIC 9(6). 05 SERIE-ME PIC X(3). 05 TIPO-ME...
need to convert file microfocus cobol isam linux to csv: using syntax: java -jar ../lib/Cobol2Csv.jar -I ES-02 -O ES-02.csv -C FD-MOV.ARQ -D; -FS Fixed_Length does not convert comp fields ~~~cobol 01 REG-MOV-ESTOQUE. 03 CHAVE2-ME. 05 CODIGO-ME PIC 9(5). 05 DATA-ME. 07 ANO-ME PIC 9(4). 07 MES-ME PIC 99. 07 DIA-ME PIC 99. 05 COD-MOV-ME PIC 9(4). 05 CONT-ME PIC 9(3). 03 NF-ME. 05 DATA2-ME. 07 ANO2-ME PIC 9(4). 07 MES2-ME PIC 99. 07 DIA2-ME PIC 99. 05 NR-DOC-ME PIC 9(6). 05 SERIE-ME PIC X(3). 05 TIPO-ME...
need to convert file microfocus cobol isam linux to csv: using syntax: java -jar ../lib/Cobol2Csv.jar -I ES-02 -O ES-02.csv -C FD-MOV.ARQ -D; -FS Fixed_Length does not convert comp fields ~~~cobol 01 REG-MOV-ESTOQUE. 03 CHAVE2-ME. 05 CODIGO-ME PIC 9(5). 05 DATA-ME. 07 ANO-ME PIC 9(4). 07 MES-ME PIC 99. 07 DIA-ME PIC 99. 05 COD-MOV-ME PIC 9(4). 05 CONT-ME PIC 9(3). 03 NF-ME. 05 DATA2-ME. 07 ANO2-ME PIC 9(4). 07 MES2-ME PIC 99. 07 DIA2-ME PIC 99. 05 NR-DOC-ME PIC 9(6). 05 SERIE-ME PIC X(3). 05 TIPO-ME...
delimiter text " "
need to convert file microfocus cobol isam linux to csv: using syntax: java -jar ../lib/Cobol2Csv.jar -I ES-02 -O ES-02.csv -C FD-MOV.ARQ -D; -FS Fixed_Length does not convert comp fields 01 REG-MOV-ESTOQUE. 03 CHAVE2-ME. 05 CODIGO-ME PIC 9(5). 05 DATA-ME. 07 ANO-ME PIC 9(4). 07 MES-ME PIC 99. 07 DIA-ME PIC 99. 05 COD-MOV-ME PIC 9(4). 05 CONT-ME PIC 9(3). 03 NF-ME. 05 DATA2-ME. 07 ANO2-ME PIC 9(4). 07 MES2-ME PIC 99. 07 DIA2-ME PIC 99. 05 NR-DOC-ME PIC 9(6). 05 SERIE-ME PIC X(3). 05 TIPO-ME PIC X....
I added it into JRecord itself: https://sourceforge.net/p/jrecord/code/HEAD/tree/jrecord/Source/JRecord/src/net/sf/JRecord/Details/RecordDetail.java...
thanks Bruce for the update. just wanted to know for reference , where did you make...
I have uploaded a new version https://sourceforge.net/projects/coboltocsv/files/CobolToCsv/Version_0.81.4/...
thanks bruce for all your help
I have created an update that supports a \u0001 syntax; see: https://sourceforge.net/projects/coboltocsv/files/CobolToCsv/Version_0.81.2/CobolToCsv_0.81.3TstUpdate.7z/download...
I have created an update that supports a \u0001 syntax; see: https://sourceforge.net/projects/coboltocsv/files/CobolToCsv/Version_0.81.2/CobolToCsv_0.81.3TstUpdate.7z/download...
thanks a ton Bruce. may i know the default value for output character set
There is a partial solution, you can do (Column headers) java -jar ../lib/Cobol2Csv.jar...
No probelm Bruce, will update the code for my own usecase . your inputs will be helpful...
At the moment no. I will add an option in for this; but it might take a while, (I...
Hello Bruce, hope your doing good. Does CobolToCsv utility supports control A as...
thanks a lot bruce
Csv2Cobol will pad out fields if needed when it converts files back to Cobol. Text...
Yes Bruce , i am using Csv2Cobol only. will Csv2Cobol handles this issue while converting...
One place you could make the change is in the doCopy method at line 353 in the class...
One place you could make the change is in the doCopy method at line 353 in the class...
One place you could make the change is in the doCopy method at line 353 in the class...
Yes Bruce , we are converting csv files back to ebcdic after making some changes...
At the moment no, I will have a think about what is involved. Is there any reason...
Hello Bruce, Thanks for this wonderful tool I am trying to convert fixed length mainframe...