Not able to convert COBOL to JSON/XML/CSV

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
charis29
Posts: 1
Joined: Wed Apr 18, 2018 4:05 am

Not able to convert COBOL to JSON/XML/CSV

Post by charis29 »

I have some data from an outside customer from a COBOL system. It appears to be a copybook and the associated data. I'm trying to use TextPipe Pro trial to test out converting one of these files, however, I so far have been unsuccessful. I keep getting an error saying that 'Fields all have zero length'. Below is a sample of the copybook and data. Any feedback or assistance would be greatly appreciated. Thank you.

Code: Select all

 1 CHECK-MASTER                                                      AN      1    815    815  
 2 CK-RECORD-ID                                            XX        AN      1      2      2
  2 CK-CONTROL-PRIMARY                                               AN      3     43     41
   3 CK-COMPANY-CD                                         X         AN      3      3      1

Code: Select all

CK07/03/201300000000000000992DAC1AMH070300000745190760000A703000220 010706306/04/2004RMH 0140208YOUNGS MOBILE HOMES & TRAVEL  1450 DICKINSON ST                                           FREMONT  OH                   000043420                               0000016.7506/04/2004RMH 00000000000000000000OH14006 00010.75 00056.000000207346 00100.00106/04/200400018111 000000004/30/2004RMH 06/30/2004 0000000000    06/04/2004RMH 0000000000                                            
CK07/03/201300000000000000993DAC1AMH070300000748206870000A703000330 010837209/21/2004RMH 0081532YOUNGS MOBILE HOMES & TRAVEL  1450 DICKINSON ST                                           FREMONT  OH                   000043420                               0000287.7509/20/2004RMH 00000000000000000000OH14500 00352.75 00035.000000208125 00100.00109/20/200400019051 000000009/30/2004RMH 09/30/2004 0000000000    09/21/2004RMH 0000000000                                            
CK07/03/201300000000000000994DAC1AMH07030000075B269010000A703000220 011351811/30/2005RMH 0085714YOUNGS MOBILE HOMES & TRAVEL  1450 DICKINSON ST                                           FREMONT  OH                   000043420                               0000309.9711/30/2005RMH 00000000000000000000OH14500 00164.97 00189.000000210385 00100.00111/30/200500022121 000000011/30/2005RMH 11/30/2005 0000000000    11/30/2005RMH 0000000000 
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Not able to convert COBOL to JSON/XML/CSV

Post by DataMystic Support »

Hi there,

TextPipe accepts 2 copybook types - these can be viewed in the help file.

Yours is of the second type, sample here:

Code: Select all

RECORD CD                                    1 AN          1
PURCHASE REQUEST NUMBER                     14 AN          2-15
PR LINE ITEM NUMBER                          6 AN         16-21
QUANTITY                                     5 P          22-26
UNIT OF ISSUE                                2 AN         27-28
STANDARD UNIT PRICE                          5 P          29-33
FUND CLASS CODE                              3 AN         34-36
STOCK NUMBER                                15 AN         37-51
TextPipe only needs the field name, length and type, not the remaining characters

So change your copybook to this - and ensure 'Ignore columns 1-6' is UNCHECKED

Code: Select all

		CHECK-MASTER                                            1          AN      
		CK-RECORD-ID                                            1        AN      
		CK-CONTROL-PRIMARY                                      3        AN      
		CK-COMPANY-CD                                         3         AN     
Which results in this parse tree for the copybook:

Code: Select all

 -01 COPYBOOK                                                           1-8 Length:8
   01 CHECK-MASTER X(1).                                                1 Length:1
   01 CK-RECORD-ID X(1).                                                2 Length:1
   01 CK-CONTROL-PRIMARY X(3).                                          3-5 Length:3
   01 CK-COMPANY-CD X(3).                                               6-8 Length:3
Post Reply