Well, no belittling was intended. I asked for clarification, eight minutes after the question was posted. I think what is wanted is clear, I just can't see how what is wanted can be used. I'd want to avoid achieving something and then finding there's not much use for it.
It's generating a COBOL definition. What is it to be used for? It could be included many times in a COBOL program, but the data-names could never be referenced. Even if they are "eye catchers" for something, there is no point in the names, they could all be FILLER (or omitted, which is the same). If they are to be eye-catchers, then there is a problem, as IBM's Tom Ross has confirmed that going forward we should not rely on the order of things in WORKING-STORAGE, as the compiler may in the future re-order things for performance reasons, as, with V5.2, it already does/can do with the LOCAL-STORAGE.
If they are to go into separate programs, will the data be referenced? That'll be OK when referenced individually, but there is no benefit in the different field lengths. They can all be PIC X(100) without any problem, so simplifies the coding in the Rexx, and makes them all "stardard" for understanding if they do happen to be seen in a dump. Again, if eye-catchers, same problem as above - in the future, they may not appear immediately before the data they are catching for.
There's a task arpitpatel01 has, and I'm not sure the solution being sought best fits that task, but it is difficult (impossible) to be sure without feedback.
I think enrico's code is what is wanted, I just don't know what is going to be done with it.
Should I just keep quiet?
As to what was needed for the code, I'm surprised that the interaction with the user was achieved successfully, without being able to have some stab at the layout-generation to show us, so we can guide as to what any problems were.