We help IT Professionals succeed at work.

Migration Problem

Meena_kumari
Meena_kumari asked
on
941 Views
Last Modified: 2013-12-26
Hi,
Earlier I asked a question here for migration. Thanks for all those answers.

Now I am fixing the migration issues. The approach I followed is, copied PB9 PFC pbls into my application overrding the PB6.5 PFC's. Then migrated. Faced a very few problems on obsolete funcs. Fixed all of them but one problem I am not able to understand. In one of the application pbl's it is calling n_cst_string.of_parsetoarray() function. Migration gave "Misused Type : n_cst_string" on this line.

I checked up the n_cst_string object in both versions. There are no differences. The argument types are also same in both versions. The last one being a reference variable.

The syntax present in my object is n_cst_string.of_parsetoarray(ls_upcstring, ",", ls_upc_array[]). I do not understand in what way to fix it.

Can anyone please help. Very urgent as I have to send a migrate report today.
Comment
Watch Question

hi,
1) just replace your code with declaring a variable and check

n_cst_string    inv_string
inv_string.of_parsetoarray(ls_upcstring, ",", ls_upc_array[])

variable declaration will be private or instance or globle according to your requirement.

2) also confirm that nowhere else (in other pbls of the library list), the same object (n_cst_string) is there and having different defination. but i think this will not be the case.

check with first solution.
regards,
sandeep
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Hi Sandeep,
Thanks for the answers. I tried both options earlier itself.
The first option we cannot do because it is an autoinstantiate class, and doesn't require a variable declaration of its type. The second option, The original code was having no brackets after ls_upc_array. I tested it with brackets. Both din't work.

Now I am planning to temporarily comment the code, migrate, and uncomment in PB9, see what happens. Let me try this out.

Meanwhile if you can think of any other solutions please post them. Thanks alot.
ya, commenting the code will definately work.

although can u post entire script here?

Author

Commented:
Sandeep, please find the script here.

/////////////////////////////////////////////////////////////////////
//
// Script for n_cst_proc_fndg_b120.of_updateprdvariant event.
//
/////////////////////////////////////////////////////////////////////
// Arguments:
//            None
/////////////////////////////////////////////////////////////////////
// Return: (integer)
//            1      -      Cancel/Error
//            0      -      Continue
/////////////////////////////////////////////////////////////////////
// Description:
//            Loads the product variant table.
/////////////////////////////////////////////////////////////////////

long ll_maxrows, ll_row, ll_upper, ll_cnt, ll_vnpk_qty
string ls_upc, ls_cb_ent_id, ls_cb_role_id, ls_upc_array[], ls_upc_null[]
string ls_itemnumber, ls_new_upc
boolean lb_upc_fnd

//default vnpk_qty
ll_vnpk_qty = 1
DECLARE UPDT_PRD_VARIANT PROCEDURE FOR FNDG_UPDT_PRD_VAR(:ls_cb_ent_id, :ls_cb_role_id, :ls_itemnumber, :ls_new_upc, :ll_vnpk_qty);

ll_maxrows = ids_variant.RowCount()
FOR ll_row = 1 to ll_maxrows
      ls_upc = ids_variant.Object.upc[ll_row]
      ls_cb_ent_id = ids_variant.Object.cb_ent_id[ll_row]
      ls_cb_role_id = ids_variant.Object.cb_role_id[ll_row]
      ls_itemnumber = ids_variant.Object.variant_nbr[ll_row]
      ls_upc_array = ls_upc_null
      n_cst_string.of_ParseToArray(ls_upc, ',', ls_upc_array)
      ls_new_upc = this.of_getupc(ls_upc_array)
      EXECUTE UPDT_PRD_VARIANT;
      
NEXT
return 1
hummmmm,
your script is ok...no problem... I copied it to my application with commenting procedure and the line

ls_new_upc = this.of_getupc(ls_upc_array)

it's compiled OK...have u checked with comment ? Are u sure that n_cst_string.of_parsetoarray(ls_upc,',',ls_upc_array) is the only line that causing the problem ?
Well to me, This kind of code gives me warning : Undefined Variable :n_cst_string
I am surprized it's working for you.... Check you don't have variabled declared as :

n_cst_string n_cst_string

( if not, you can try decaring, may work but it's not the proper way..)

This is not the correct way to call function.. Even if n_cst_string is autoinstantiate, you need to declare a variable of that type and call metods on that variables. These methods are not Static mathods ( so that you can refer them by the Class..)
Auto Instantiate means you need not call create and destroy, and some difference in memory allocation..

Regards,
Vikas

Normally in a PFC app, String service will be delared as an instance variable of the app mager, and you will call functions as :

gnv_app.inv_string.of_ParseToArray(ls_upc, ',', ls_upc_array)

Well, lots of information above, but here is the gist of the problem: Trying to use a "class" function. Class functions are not supported in PowerBuilder, but most versions let you call them anyway, and sometimes they even work. Most of the time though, they cause the application to die. Like the first person said, changing the call to this will solve the problem:

n_cst_string lnv_string
string ls_upcString, ls_upc_array[]

lnv_string.of_parseToArray (ls_upcString, ",", ls_upc_array)

Note two important changes: Removal of the [] in the function call, and replacing n_cst_string with a local variable of type n_cst_string.

Author

Commented:
Hi, Thanks to all.

As I said, I migrated with commenting that piece of code, opened that object in PB9, declared local variable of type n_cst_string and called the function with that variable.
This got compiled without problems.

Thanks for all, I agree with all of your options.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.