OUTPUT = FILE CHARAT(X,Y);
is not Assembler!
You've been told this before:
use QSAM "locate" mode for input data sets; the GET macro returns the address of a record, and you do not have to provide a record buffer of your own. I use "move" mode at least once every 10 years, so there are times when it is appropriate, but they are rare indeed.
I do not see any code to find a comma. There are two common approaches. Beginners do a loop that tests each byte. More advanced programmers will use the TRT instruction to test the entire record, or at least groups of 256 bytes. A TRT solution is noticeably faster, but is harder for a beginner to understand.
GET INFILE
LR 3,1
LR 14,1
LH 0,(DCBLRECL-IHADCB)+INFILE
LR 15,0
FIND CLI 0(14),C','
BE FOUND
AH 14,=H'1'
BCT 0,FIND
FOUND AR 15,3
SR 15,14
BNP NOFILL
SR 1,1
ICM 1,B'1000',=C' '
MVCL 14,0
NOFILL ---
The GET macro is for QSAM "locate" mode I/O.
(DCBLRECL-IHADCB)+INFILE is the address of DCBLRECL in the INFILE DCB. Doing it this way is simpler than setting up addressability for the DCB data area, though the coding for the one instruction certainly look complicated!
The program will get to FOUND for two reasons. What are they?
What are the contents of register 14 for each reason the program got to FOUND?
What are the contents of register 15
after the AR instruction at FOUND executes?
What are the contents of register 15
after the SR instruction after FOUND executes? What is the purpose of the BNP instruction after the SR instruction executes?
There are three sources for the contents of DCBRECFM, DCBLRECL and DCBBLKSI in a DCB:
- Values specified in the DCB macro itself or placed there before the OPEN macro for the DCB macro executes.
- Values specified in the DD statement.
- The data set label.
It is usually a good idea to not specify values for an input data set. If you must specify something, specify just RECFM. That way, the OPEN will usually fail if the DD statement or the data set label specify something that does not agree with the RECFM.
In your next post for this topic I expect answers for the 5 questions in this post.