Page 1 of 1

USR2014N

PostPosted: Fri Sep 17, 2010 3:08 pm
by Arkantos
Hi,

After calling USR2014N im getting ED-ERRNUM as 609 and the ED-FLINE is also blank. I coudnt able to get the explanation for 609 in the documentation.

Can some one share info on the error num 609?

ED variables for reference

ED-SESNUM 0
ED-LOGFLAG N
ED-LOGNAME NATEDIT1
ED-REQUEST CLSS
ED-LIBRARY
ED-MEMBER
ED-RECLEN 250
ED-PRFLEN 6
ED-SCRLEN 72
ED-SCRNUM 104
ED-SCRMAX 999
ED-RENUM 10
ED-MCMND
ED-SCMND
ED-CAREA 0
ED-CROW 0
ED-CCLM 0
ED-RECTOP 0
ED-NEW-RECTOP 0
ED-RECNUM 0
ED-NEW-RECNUM 0
ED-FILECHG 0
ED-SRAUSED 0
ED-SRAFREE 0
ED-FLINE
ED-MSGNUM 0
ED-ERRNUM 609
ED-DUMMY N
ED-DSTYPE N
ED-RECMAX 16448


Cheers
Arkantos

Re: USR2014N

PostPosted: Fri Sep 17, 2010 5:26 pm
by ats
Hi Arkantos,

I see that below conditions are not met in your case:

1. ED-SCRMAX must be lower or equal to 100 (I see it's 999 in your case).
2. Make sure that ED-SCRNUM must be lower or equal as ED-SCRMAX

Try the changes. Hope it should work fine then.

Regards,
Ats

Re: USR2014N

PostPosted: Fri Sep 17, 2010 6:09 pm
by Arkantos
Hi Ats,

The object which im trying to create is are more then 100 lines, so i want ED-SRCNUM to be more than 100. Thats why i kept ED-SCRMAX as 999.

As per your comments, If I change ED-SCRMAX as 100, then i wont able to create the entire code in the SWA.

Is there anyway to create more than 100 lines of code in the SWA?.

I have changed the array of L-DATA-MAX in CONTROL BLOCK as 999 and changed the array for some other fields like CB-ALIN-V AT-PREF AT-DATA etc.

Cheers
Arkantos

Re: USR2014N

PostPosted: Sat Sep 18, 2010 12:53 pm
by ats
Arkantos,

The CONTROL BLOCK definition (from your program) is being passed to USR2014N. You can change it within your program but USR2014N. SAG (I believe!)doesn't provide source for the APIs hence how would we replicate the changes in PDA of USR2014N. I see it can accomodate max 100 else throws an error 609. None the less the value of ED-SCRMAX must be below or equal to 100 and all it's related fields must be in sync.

Another way, Yes! Create your own API that supports more than 100.

Hope this helps!

P.S. - Further insight is welcome from anyone.

Regards,
Ats

Re: USR2014N

PostPosted: Sat Sep 18, 2010 2:00 pm
by RGZbrog
Warning! Blatant preaching ahead!

The reason that so may Natural Administrators restrict access to SYSEXT is the potential for serious damage caused by inexperienced programmers who do not yet understand Natural's structures and processes. This Forum is for beginners and students. Beginners and students lack the experience to be changing Natural code dynamically with USR2014N. USR2014N should not be used without the express approval and full support of your manager or technical lead.

... preaching ends.

Technically speaking, a Natural module can have up to 9,999 source lines - the limit is imposed by a 4-digit line number. USR2014N can handle any Natural module, because it does so in portions. Here are some code snippets from one of my utility programs.

1 #SCRMAX (I2) CONST<100>
1 #SCRLEN (B2) CONST<74>
1 #PRFLEN (B2) CONST<4>

ASSIGN ED-REQUEST = 'OPEN'        /* Start an edit session

RESET  ED-SESNUM           
CALLNAT "USR2014N" #USR2014
ASSIGN #SESNUM = ED-SESNUM   
ASSIGN #REC    = ED-NEW-RECNUM

FOR #J = 1 #REC #SCRMAX              /* Increments of #SCRMAX
  ASSIGN ED-REQUEST    = 'GETL'
  ASSIGN ED-NEW-RECTOP = #J          /* Position to top of increment
  ASSIGN ED-SESNUM     = #SESNUM
  CALLNAT "USR2014N" #USR2014
  /*                                 /* Insert view definition
  FOR #I = 1 #SCRMAX                 /* Presumes SCRNUM = SCRMAX
    ASSIGN  #LINE = L-LINE (#I)

ASSIGN ED-REQUEST = 'CLSS'           /* Close session
ASSIGN ED-SESNUM  = #SESNUM
CALLNAT "USR2014N" #USR2014


Be careful! Be very careful.

Ralph Zbrog
LEN Consulting LLC

Re: USR2014N

PostPosted: Sat Sep 18, 2010 10:31 pm
by dick scherrer
Hello,

Preaching continues. . .

Keep in mind that if the current setup has worked for everyone else who has used the same environment, it is not likely that this "requirement" needs an environmental change. Suggest you talk with those more senior for a different aproach that they have already used.

Also (and possibly more important) people have been terminated for attempting to alter the environment (or do other unauthorized "things") without direction/permission. If you intend to proceed you need to get written confirmation that this is acceptable.

fwiw

Re: USR2014N

PostPosted: Tue Sep 21, 2010 12:11 pm
by Arkantos
Hi All,

Thanks for the replies. I can see the importance of handling the SYSEXT library and the API's from your replies.

Ralph,

I coudnt able to get the logic of the code that you have provided. But i have over come the SWA loc. I have created a copycode before creating the program and i used that copycode in the program. That way i reduced the program line below 100 :) .

Thanks Again

Cheers
Arkantos