Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

4.3.1.2 MIMS.ModifyDistrict method problem

Status
Not open for further replies.

ssmgr

Technical User
Feb 2, 2003
40
AU
Has anyone managed to successfully change district using Connector in MIMS OE 4.3.1.2? My code runs successfully and produces no errors, but I end up in the same district that I started in.

I have provided a bit of my function code. Am I doing something wrong?


......

Private Function ChangeDists(newdistrict As String) As Boolean


Dim block As MIMSBlock
Dim request As MIMSRequest
Dim instance As MIMSInstance
Dim field As MIMSField
Dim reply1 As MIMSReply
Dim erroritem As MIMSError

DoEvents
Set block = gobjMIMS.Blocks.New("newdist")
block.Requests.New ("Request")
block.Requests("Request").AddFieldNameValue "_Service", "MIMS.ModifyDistrict"
block.Requests("Request").Instances.New ("Instance")
block.Requests("Request").Instances("Instance").AddFieldNameValue "District", newdistrict


On Error GoTo districterror
Set reply1 = block.Send
' this appears to work fine, reply1 returns 3 null values
gobjMIMS.Blocks.Remove ("newdist")
ChangeDists = True
Exit Function


......
After the send, function ChangeDists returns true. However, a subsequent call to method MIMS.FetchCredentials returns the same value for field "District" as before ChangeDists was called.

Any advice would be appreciated.
 
Don't have one. I'm set up with multiple district access but no default, so in green screen I'd be presented with the MSM002A screen and asked to select one. In GUI I have to specify one in the login dialogue box.

I also probably should have mentioned, our implementation bypasses MIMS security. The data resides on an OS/390 mainframe, and we're using RACF to control access, so there's no MIMS passwords and associated records (expiry dates etc).
 
Interesting. Had not used this particular object operation before. Tried it and same result as you posted. No problem with changing position tho.
Time to get Mincom earning their $$. Report it to them.
Good Luck
 
I agree with both ssmgr and chkote. I have run some tests on 5.2.3. The MIMS.ModifyDistrict does not appear to work. The MIMS.ModifyPosition seems to work Ok.

I have a couple of workarounds to change district.

Workaround #1: Call the MIMS.Login method using new district.
Workaround #2: Disconnect the MIMSXServer session and reconnect (silently) using new district.

Details for #1:
[ul]
[li] Call MIMS.FetchCredentials to get UserId, and Position (if they are to stay the same)[/li]
[li] Get new district code (eg from user input)[/li]
[li] Get password gobjMIMS.GetParameter(MIMSX_PARAM_MIMS_PASSWORD)[/li]
[li] Call MIMS.Login with some code similar to following snippet
Code:
  Block.Requests.New (1)
  
  Block.Requests(1).AddFieldNameValue "_Service", _
    "MIMS.Login"
  
  Block.Requests(1).Instances.New (1)
  
  Block.Requests(1).Instances(1).AddFieldNameValue _
    "UserId", UCase(Trim$(inputUser))
  Block.Requests(1).Instances(1).AddFieldNameValue _
    "Password", UCase(Trim$(inputPassword))
  Block.Requests(1).Instances(1).AddFieldNameValue _
    "Position", UCase(Trim$(inputPosition))
  Block.Requests(1).Instances(1).AddFieldNameValue _
    "District", UCase(Trim$(inputDistrict))
  
  On Error GoTo ErrorHandler
  
  Set Reply = Block.Send
[/li]
[/ul]

Details for #2:
[ul]
[li] Save current connection details (or combine with a MIMS.FetchCredentials) with some code similar to following snippet
Code:
  sHost = gobjMIMS.GetParameter(MIMSX_PARAM_HOST)
  sPort = gobjMIMS.GetParameter(MIMSX_PARAM_PORT)
  sHostUser = gobjMIMS.GetParameter(MIMSX_PARAM_USERNAME)
  sHostPass = gobjMIMS.GetParameter(MIMSX_PARAM_PASSWORD)
  sMimsUser = gobjMIMS.GetParameter(MIMSX_PARAM_MIMS_USER)
  sMimsPass = gobjMIMS.GetParameter(MIMSX_PARAM_MIMS_PASSWORD)
  sMimsPosn = gobjMIMS.GetParameter(MIMSX_PARAM_MIMS_POSITION)
  sMimsDist = gobjMIMS.GetParameter(MIMSX_PARAM_MIMS_DISTRICT)

  Call MIMS_Disconnect
[/li]
[li] Get new district code (eg from user input) into sMimsDist[/li]
[li] Reconnect (silently) with some code similar to following snippet
Code:
  gobjMIMS.SetParameter MIMSX_PARAM_HOST, sHost
  gobjMIMS.SetParameter MIMSX_PARAM_PORT, sPort
  gobjMIMS.SetParameter MIMSX_PARAM_USERNAME, sHostUser
  gobjMIMS.SetParameter MIMSX_PARAM_PASSWORD, sHostPass
  gobjMIMS.SetParameter MIMSX_PARAM_MIMS_USER, sMimsUser
  gobjMIMS.SetParameter MIMSX_PARAM_MIMS_PASSWORD, sMimsPass
  gobjMIMS.SetParameter MIMSX_PARAM_MIMS_POSITION, sMimsPosn
  gobjMIMS.SetParameter MIMSX_PARAM_MIMS_DISTRICT, sMimsDist

  If Not gobjMIMS.Connect(True) Then  '(True)=silent
    bMimsxConnected = False
    Call MIMS_Disconnect
    GoTo All_Done
  End If
[/li]
[/ul]
I haven't found a good use in a real application yet for this, but doing a MIMS.FetchCredentials seems to indicate that the district is being successfully changed.
 
Thanks PhantomPhil, I tried your second suggestion and it worked a treat.

In our implementation, the MIMSX_PARAM_MIMS_PASSWORD isn't used because MIMS security is bypassed. If I call .getparameter(MIMSX_PARAM_PASSWORD), it returns a string of gobbledy-gook characters - I assume it's the encrypted password.

I'm sure I've tried what PhantomPhil suggested before without success, but now that I look back on it, I reckon I forgot to specify a silent login for the reconnection. The login dialogue box always appeared asking for a password, so I always figured there was something on our implementation that prevented the password from being passed in as a string. Wrong - funnily enough, the application was doing what I told it to.

So ... thanks to PhantomPhil I can work around it, but I'll see if I can get a work order raised so Mincom can fix it.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top