Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v5.2
  HXTT Cobol v2.1
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT DBF v5.2
  HXTT Excel v4.2
  HXTT Paradox v5.2
  HXTT Text(CSV) v5.2
  HXTT XML v1.2
Offshore Outsourcing
Oracle Data Import/Export
DB2 Data Import/Export
Sybase Data Import/Export
Free Resources
  Firewall Tunneling
  Search Indexing Robot
  Conditional Compilation
  Password Recovery for MS Access
  Password Recovery for Corel Paradox
  Checksum Tool for MD5
  Character Set Converter
  Pyramid - Poker of ZYH
   
   
   
Hongxin Technology & Trade Ltd. of Xiangtan City (abbr, HXTT)

HXTT Cobol
How to query multi-segment COBOL Structure
Glenn
2016-10-20 13:54:55.0
I have a multi-segment RM COBOL file that is described like this:

01 MSVALU-REC.
05 MSVALU-KEY.
10 MSVALU-TYPE PIC X. 001
10 MSVALU-MODEL PIC X(12). 002
10 MSVALU-MODEL-ID PIC X. 014
10 MSVALU-REP-AREA PIC 999. 015
10 MSVALU-SEQ PIC 99. 018
05 MSVALU-MODEL-INFO.
10 MSVALU-MODEL-TABLE OCCURS 10 TIMES.
15 MSVALU-IDS PIC X.
15 MSVALU-IDS-TEXT PIC X(20).
10 FILLER PIC X.
05 MSVALU-AREA-INFO REDEFINES MSVALU-MODEL-INFO.
10 MSVALU-AREA-TABLE OCCURS 10 TIMES.
15 MSVALU-AREA PIC XXX.
15 MSVALU-AREA-TEXT PIC X(18).
10 FILLER PIC X.
05 MSVALU-COMP-INFO REDEFINES MSVALU-MODEL-INFO.
10 MSVALU-COMP-TABLE OCCURS 10 TIMES.
15 MSVALU-COMP PIC XXX.
15 MSVALU-COMP-TEXT PIC X(18).
10 FILLER PIC X.

When I attach to the associated .DAT file and query it, I get everything as a flat structure with the MSVALU-MODEL-INFO segment as one big (structured) string. Here are the results from:

SELECT * FROM MSVALU

MSVALU-TYPE MSVALU-MODEL MSVALU-MODEL-ID MSVALU-REP-AREA MSVALU-SEQ MSVALU-MODEL-TABLE
----------- ------------ --------------- --------------- ---------- ------------------
A CTS F 0 1 [[0,13PERIODIC MAINT. ],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null]]
C 1110C F 5 1 [[0,05COLD WEATHER START],[0,11RADIATOR & FAN SHR],[0,12FAN ],[0,15ENGINE SPEED CONTR],[0,21AIR CLEAN & PIPING],[0,31MUFFLER & EXHAUST ],[0,40ENGINE MOUNTING ],[0,61EX FUEL PUMP ],[0,63FUEL LINES & FIT ],[0,64FUEL TANK ]]
C 1110C F 7 1 [[0,52CLUTCH ELEMENTS ],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null],[null,null]]
...
more rows...
...

Is there a way to select the lower segments (i.e. the MSVALU-MODEL-INFO or MSVALU-AREA-INFO ror MSVALU-COMP-INFO)? Something like:

SELECT * FROM MSVALU.MSVALU-MODEL-INFO
or
SELECT * FROM MSVALU/MSVALU-MODEL-INFO
or
SELECT * FROM MSVALU\MSVALU-MODEL-INFO
or
SELECT * FROM MSVALU[MSVALU-MODEL-INFO]
or
SELECT * FROM MSVALU-MODEL-INFO

(all of which I have tried)

I have also tried variants on reading just the defined structures as a column, like this:
SELECT "MSVALU-COMP-INFO" from MSVALU

And while this returns data, it does not look like just the particularly defined or redefined segments.

Any help would be appreciated.

Regards,
Glenn
Re:How to query multi-segment COBOL Structure
HXTT Support
2016-10-20 17:17:05.0
MSVALU-MODEL-INFO is a compound column, and you have some alias column too. It can not be take as table name. You can use those column names directly in your sql. For instance,
select "MSVALU-AREA-TEXT", "MSVALU-COMP-INFO","MSVALU-COMP-TABLE(3)","MSVALU-COMP-TABLE","MSVALU-COMP","MSVALU-SEQ" FROM MSVALU
Re:Re:How to query multi-segment COBOL Structure
Glenn Wiebe
2016-10-21 07:53:50.0
Great. Thanks.

It would be nice if the JDBC exploration api actually showed that these values were there and the SELECT * would return them.

Regards,
Glenn
Re:Re:Re:How to query multi-segment COBOL Structure
HXTT Support
2016-10-22 07:55:35.0
You wish a feature select * from MSVALU.MSVALU-MODEL-INFO
will show

MSVALU-MODEL-TABLE? but MSVALU-MODEL-TABLE is an array column

MSVALU-IDS(2), MSVALU-IDS-TEXT,MSVALU-IDS-TEXT(3), MSVALU-MODEL-TABLE,MSVALU-MODEL-TABLE(0) can be used in your sql.

Maybe you need a function,

For instance select top 1 subcolumnname('MSVALU-IDS') from MSVALU ?


Search Key   Search by Last 50 Questions




Google
 

Address: 9 Station Rd., Xiangtan City, Hunan Province, P.R. China
Postcode: 411100
Phone: (86)731-58225727
Fax: (86)731-58225727
Email: webmaster@hxtt.com
Copyright © 1999-2011 Hongxin Technology & Trade Ltd. | All Rights Reserved. | Privacy | Legal | Sitemap