Hi Dipti,
We can write records with different fields to the same work file and need to use different WRITE WORK FILE statements. However, in this case, the VARIABLE clause must be specified in all WRITE WORK FILE statements. The records on the external file (assigned within JCL) will be written in variable format. Natural will write all output files as variable-blocked (unless you specify a record format and block size in the execution JCL).
Assuming you know the simple WRITE WORK FILE structure, below is an example with VARIABLE clause:
WRITE WORK FILE 1 VARIABLE #FIRST-NAME #LAST-NAME
........ (statements to be followed)
........
WRITE WORK FILE 1 VARIBALE #FIRST-NAME #LAST-NAME #ADDRESS-LINE-1 #PHONE-NUMBER
Thanks,
Ats