0 pts.
 UNABLE TO WRITE TO A FLAT FILE FROM DS
Hi Am trying to move a data structure to a flat file.The flat file field name is SASAM. The error is The Result-Field operand SASAM is not valid for the specified operation. The data to be written is CCODE and then the value in HCMPYV. Please find code snippet for ur reference FSASAM IF A E DISK F RENAME(SASAM:SA100) D*HDR DS D*HCMPY 1 11 INZ('CCode') D*HCMPYV 12 13 SRHEAD BEGSR MOVE HDR SASAM WRITE SA100 ENDSR

Software/Hardware used:
ASKED: January 6, 2009  4:07 PM
UPDATED: January 6, 2009  6:39 PM

Answer Wiki:
Hi, Firstly you have your file declared as input with add - the compiler will expect you to do some sort of input operation on the file, unless you declare the file as output. Your file name is SASAM, you have renamed the record format name from SASAM to SA100. It looks like your D-specs are commented out (with the *s). You move HDR to SASAM (which is the file name, not a field name). I think your biggest problem is the confusion between the file name and the field name. Regards, Martin Gilbert.
Last Wiki Answer Submitted:  January 6, 2009  4:53 pm  by  Gilly400   23,625 pts.
All Answer Wiki Contributors:  Gilly400   23,625 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

The * is in there by mistake…As regards the flat file when i use the crtpf to create the flat file by default the file gets created with the same name SASAM for file ,rcdfmt and the field name.Do i need to create a pf with dds that has only one field in whic case i may be able to give diffrerent names.
Can you please clarify if i need to move the data struct hdr to the file name or field name.

 0 pts.

 

a sample may be of good help

 0 pts.

 

For flat files
1. Create the file — CRTPF name library and record length
2. The F statement is Fixed not external length must match the data structure
3. write to the file result field = datastructure.
Here is example:

FSASAM O f 13 disk

Dhdr ds
D HCMPY 11 inz(‘CCode’)
D HCMPYV 2 inz(‘YV’)

C write SASAM hdr
C Eval *inlr = *on
C return

 44,130 pts.