Extract and Array from a Free Form External Ds
Posted: Tue Aug 29, 2023 12:59 am
I have an external character data structure that is 1910 characters. I want to group the last several contiguous fields in the structure into one field so I can store the information in an array and then build a JSON string including it. The field would cover the last 1215 characters of the external DS. How would I define that field in the program within the external DS? Thanks
Dcl-ds DS_Response extname('ISSUERESP')
Resp_Printers Char(1215) Overlay ??
End-ds;
Key Fld Start Fld
Field Name Pos Typ Pos Len Field Text
---------- --- --- ----- ----- ---- --- --------------------------------------------------
PRTTYPDFRP A 696 10 Printer Type - Default Start the field here
PRTTRYAERP A 1910 1 Printer Tray - Alternate End the field here
There are a lot fields in between. There are 15 array elements in the 1215 character portion of the DS
One array element would be:
PRTTYPDFRP A 696 10 Printer Type - Default
PRTNAMDFRP A 706 10 Printer Name - Default
PRTNIDDFRP A 716 60 Printer Network ID - Default
PRTTRYDFRP A 776 1 Printer Tray - Default
I want to place the 15 elements into a DS:
Dcl-DS Ds_Printers Qualified Dim(15);
printerType Char(10);
printerName Char(10);
networkID Char(60);
trayNumber Char(1);
End-DS;