RATE THIS ANSWER
+2
Click to Vote:
2
0
Please find below a screenprint of a rule that puts the content of a table in a dataset in a CSV-format.
The first record in the dataset contains the names of the fields of the table. This is a quite generic way to do what is asked. The table in question has only one parameter (but this can be easily adjusted as needed...)
RULE EDITOR ===> SCROLL: P
KPDOWNLOAD(P_TAB, P_PARM, P_FILE_NAME);
_ LOCAL L_RECORD;
_ ---------------------------------------------------------------------------
_ ------------------------------------------------------------+--------------
_ CALL @OPENDSN(P_FILE_NAME); ¦ 1
_ FORALL FIELDS(P_TAB) : ¦ 2
_ L_RECORD = L_RECORD || FIELDS.NAME ||','; ¦
_ END; ¦
_ CALL @WRITEDSN(HEADSTRING(L_RECORD, LENGTH(L_RECORD) - 1)) ¦ 3
_ ; ¦
_ FORALL P_TAB(P_PARM) : ¦ 4
_ L_RECORD = ''; ¦
_ FORALL FIELDS(P_TAB) : ¦
_ L_RECORD = L_RECORD ||(P_TAB).(FIELDS.NAME) ||','; ¦
_ END; ¦
_ CALL @WRITEDSN(HEADSTRING(L_RECORD, LENGTH(L_RECORD) - ¦
_ 1)); ¦
_ END; ¦
_ CALL @CLOSEDSN; ¦ 5
_ ---------------------------------------------------------------------------
Maybe copy the part above to a fixed width lettertype to view what is actually the screenprint.
The P_FILE_NAME has to be a fully qualified dataset-name (may be a member in a PDS). This rule is to be called from batch preferably, but from within a TSO-execution-environment it should work also. Be aware that it is best to have the PDS defined before use.
Experiment, and you will learn.
That's All Folks,
Harald.
Last Answered:
Oct 2 2009 2:15 PM GMT by HaraldvK 
55 pts.