I am requested to save data from ABAP to a flat file in a <b>library</b> in OS/400. The name of the library is LEISAP. Searching around, I found out that I can access it using the path /QSYS.LIB/LEISAP.LIB/ and it already has some files. I am able to read the files in this library (for example the file MPSHR01606) using OPEN DATASET FOR INPUT with a filename like /QSYS.LIB/LEISAP.LIB/MPSHR01606.FILE/MPSHR01606.MBR.
But I can not figure out how to create a new file. What I am trying to do is:
OPEN DATASET file
FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
where file has the value '/QSYS.LIB/LEISAP.LIB/TEST.FILE/TEST.MBR', but it fails with sy-subrc = 8.
Any idea if it is possible to create a file in a libary in OS/400 from ABAP at all and how?