CMADA or USR1043 - LF command


Does anyone have any example in how to use CMADA routine (command LF) to read an FDT?
I have been trying to call CMADA, but it is not returning any information. I am using CB with RBL, FNR, COP2 as S option, but no RB is returned. I think I doing something wrong but I am not sure what would be, so, if anyone have any example code to inform me, I would thank.


Search the forums for “FDT” and you’ll find a working program under “FDT Listing” in Natural Code Samples.

It uses USR1043N which, unlike CMADA, is officially supported by SAG.

Hi Ralph,

thank you for the information, but do you have an option to get the format and length of SP/SB fields or do I need to check the fields that belongs to SP/SB?

thank you again.


The SDT entry gives you the start/end offsets for both SP and SB fields and descriptors.

The S option of the LF command provides neither format nor length of SP/SB. You can compute the length of each component within the code sections starting with VALUE ‘S’, VALUE ‘T’, and VALUE H’00’:

#DISP.#LEN := #DISP.#TO - #DISP.#FM + 1

The tricky bit is to display an accumulated length on the same line as the descriptor name. That’s too much work for me.

It appears that the F and X options supply the descriptor’s length and format, but a major rewrite of my program is needed. That’s still on my “to do” list.