Reporting and Structured Mode

hello
I am studying on structured and reporting modes.

I found lots of information on help.

But one question remained: how to determine the mode for a library or program?

how this works in practice?

Reporting mode is “legacy” and there’s no reason to use it when creating new systems (Steve Robinson may want to “correct” me on that one), and usually one just sets structured mode on    globally

Although I never code in Reporting mode anymore, I still don’t recommend setting SM=ON in NatParms.

Despite the existence of nice tools like Object Handler, I often find that the quickest way to copy a module between machines/Fusers is to drag&drop onto my desktop or a flash drive. When you drag a module onto the target Fuser library, Natural presumes Reporting mode. If SM is set to ON, then you can’t open the new (Reporting Mode) module. And if SM is set to ON in NatParms, then you can’t set it to OFF within your Natural session.

A workaround would be to LIST the module, select all (ctrl-a), open a new module, and then paste (ctrl-v). Yuck!

I set SM=OFF in NatParms to allow editing of any module. I have an SM icon on my Natural Studio status bar, so Structured/Reporting modes are just a click away.

Right! If SM is ON via natparm you’re not able to set it OFF. It results in NAT1155.

BTW: We’re using report mode for setting WH dynamically.

SET GLOBALS WH=ON

This is valid report mode syntax for a natural program. But it won’t work in structured mode.

set globals works in structured mode (natural 6.3.12)

:shock: You’re right! Thank you for the hint. It also works on my NAT 6.3.9. But I’m quite sure that it didn’t work on former versions of natural.

To be honest, I don’t even remember when I last had to resort to Report Mode.

When I use SM 99% of the time I’d just make it the default and create a 2nd parameter
module with SM=OFF.

what better way to use the structured mode in 99% of objects
and a few report mode?

created lots and lots of objects in report mode
more now to create the new without losing the way of old objects?

Well, in a “real world” scenario, i.e. when you develop code for
a Natural shop, virtually no one will create substantial numbers
of Report Mode objects nowadays, all new code will be SM, but
most shops have a bunch of “legacy” objects still in RM but noone
cares to rewrite them, and it isn’t required (yet), they still work.

hello wolfgang
ok… about the legacy I understood.

Good, I developed so many objects in report mode
I used the report mode only while it was to learn more
now with your explanation I understand that very little use.

Now:
if I change to structured mode in NATPARM
he did not give me more access to objects created with the mode report (NAT1155 Reporting mode not permitted)

ie I want to turn all the objects to structured mode.

how should I do?

Leave SM=OFF in Natparm, then in Natural open your Report Mode objects,
change their type to Structured Mode, STOW them.

Once all objects are converted you can switch to SM=ON in Natparm.

Or simply create a 2nd Natparm, one with SM=ON and the other with SM=OFF and create
two shortcuts for starting Natural, one for each Natparm

Thanks.

There are a number of reasons to have multiple NatParm definitions, but manipulating SM is not one of them. You’re already in Natural when you realize the SM setting is wrong. Why would you start another instance? Just click on the SM icon that you prepared as part of your one-time Studio set-up.

All the tools and settings that you use frequently should be available with a single click, including SM. I’ve attached an image of my customizations. Next to the command line, you see
. SM
. Format Source
. DU
. SYMGEN
. Line Numbers
. Renumber
. Tile Vertically
. Tile Horizontally
. Expand/Collapse
. Expand/Collapse
. Object Compare
. SYSEXT

Ralph,

when you create SM objects 99,9% of the time why bother having to click a button ?

From my experience / workflow if I ever need to deal with a RM object it’s (by far) less
cumbersome to just start a 2nd Natural session with that SM=OFF Natparm for that
single object or two once in a while.

But of course, ymmv :wink:

OK, Wolfgang. We usually agree on everything, but this time you’ve lost me. I must be missing something.

You invoke Natural, attempt to edit a module, and Natural issues a message that it can’t edit in reporting mode. You find your shortcut on your desktop, invoke Natural, and wait for it to initialize. You re-locate the reporting mode module and open it. You then decide whether to edit in reporting moe or enter GLOBALS SM=T on the command line.

I invoke Natural, and open the same module, regardless of the mode. If in reporting mode, I decide whether to continue editing that way, or to click SM.

Now, how is my procedure cumbersome in comparison?

Ralph,

it’s not about existing modules you open, Natural will pick up the mode correctly,
but when you create new modules and you start in RM you will have to click the button.

I haven’t deliberately created (or had to) RM modules for years, so there’s no need to
start in RM for me, it just saves me these extra clicks.

:idea: How about putting GLOBALS SM=… on the stack?