I am writing a dynamic SQL query to select 4 fields from a database. Hence, I have coded my DS/subfield definitions as:
D DSNAME DS
D Field1 10
D Field2 10
D Field3 10
D Field4 10
And my DECLARE/FETCH cursor statement goes like:
Declare C0 cursor for select field1, field2, field3, field4 from table
Fetch C0 into :DSNAME
At the end of execution, I have the 4 fields selected properly from my table, which is fine so far.
However, my requirement now is to select 100 fields from table. As you can see, I cannot define 100 subfields manually in the DS.
Can anyone tell me how the DS should be coded in this scenario? (Just to add, i am not doing multi-row search, just multi-field select from table)