View Full Version : Retrieval of several variable fields into one data structure subfield
dacust
07-21-2004, 07:29 AM
Just off the top of my head, I'd think fetch into a multiple occurance data structure. Then you get the fun of manipulating the occurs. That's solve your packed data situation, because the fields would all be defined. Use the file as the external description for the data structure.
Guest.Visitor
07-22-2004, 07:02 AM
I'm trying to figure out if an idea i have is possible using SQL. At present we have various batch programs that chain to a site file to retrieve relevant data. The problem is the program can perform over 2 million chains but there is only 390 records in the file. So to cut down the I/O i have written a procedure to load the data from the site file into a dynamic array which can then be searched using the C module BSearch. At present the field values that are required are defined as data structure subfields which are then loaded into the allocated memory. To make this store/retrieval procedure more generic i would like to retrieve data from the site file dependent on a list of required fields passed from the calling program and store it in a datastructure with one defined subfield with a length of 256. Is it possible to retrieve several field values via dynamic SQL into the one data structure subfield which i can then store in the allocated memory. Will i experience problems with packed data? Thanks Anthony
K.Forsythe
07-22-2004, 07:02 AM
In this example I used an externally described DS that matches the file being selected against. If the record format is large, you can improve performance by selecting only the fields that you want and including sub fields for just the selected columns. Packed data should not be a problem, you can define the numeric sub fields as zoned and I expect that SQL would perform the necessary type conversions without any extra effort on your part. Because the DS is named, you can use that name (W_CUST) in my example to refer to the entire data structure. As Daniel said, you could make this DS a multiple occurance DS, and load all of the retrieved data into it. Good luck and have fun! Kevin
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.