I am trying to write Printer file format using Data structure. Below is the code:
Dcl-Ds abc extname('prtf':'data':*output) qualified template;
End-Ds;
dcl-ds test likeds(abc) dim(100);
I am fetching records using fetch first for n rows statement into test DS array and every time it is giving me error message host variable not defined or usable.
Other hand when I'm defining a DS with same field names as in prtf 'DATA' record format, the SQL statement runs fine but when I'm writing to DATA using:
write data test(i) ;
Compiler error saying DS is not allowed for this operation. Please suggest, I would like to perform write operation using DS.
Should work. Only problem seems to be that the TEST DS doesn't have EXTNAME() nor LIKEREC(). In your first example, the EXTNAME() keyword is on the ABC DS rather than on TEST.
Since the definition is from an externally described file, there doesn't seem to be much point in having a TEMPLATE definition. The external description is already a "template" in itself.
I suspect that the SQL pre-compiler doesn't understand the redirection resulting from LIKEDS() and simply can't tell that EXTNAME() might be related.
There might be some other cause, but there's not enough program code to tell. Also, there are no error message IDs given to us, so we can't be sure what errors were reported.
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!
Discuss This Question: 1  Reply
Since the definition is from an externally described file, there doesn't seem to be much point in having a TEMPLATE definition. The external description is already a "template" in itself.
I suspect that the SQL pre-compiler doesn't understand the redirection resulting from LIKEDS() and simply can't tell that EXTNAME() might be related.
There might be some other cause, but there's not enough program code to tell. Also, there are no error message IDs given to us, so we can't be sure what errors were reported.