Problem With Files

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
asnagaraj
Participant
Posts: 26
Joined: Wed Jun 25, 2003 12:41 am

Problem With Files

Post by asnagaraj »

I have used the keymgmtnextvalue routine to create a new server routine of my own.

I have copied the code and altered it to take one more param that decides the starting number in the sequnce instead of 1 that he uses by default.

iam getting the following error when i try to compile it

Unable to write record DSU.MySequence to file DSU_BP

also if i try to Test the routine i get this error

Unable to write test harness

the code that i have in my routine is

*************************************************************************
* Copyright (c) 1997-2001 Ascential Software Inc. - All Rights Reserved. *
* This code may be copied on condition that this copyright *
* notice is included as is in any code derived from this source. *
*************************************************************************
*
* Routine to generate a sequential number. The argument is a string used to
* identify the sequence.
*
* NOTE: This routine will only work when the sequence is being accessed by
* one process at a time.
*
* The routine uses a UniVerse file to store the next number to use. This
* value is stored in a record named after the supplied argument. The
* routine reads the number once, then increments and stores the value
* in common storage, writing the next value back to file each time.
*

* Declare shared memory storage.
Common /MySeq/ Initialized, NextVal, SeqFile

EQUATE RoutineName TO 'MySequence'

If NOT(Initialized) Then
* Not initialised. Attempt to open the file.
Initialized = 1
Open "SDKSequences" TO SeqFile Else
* Open failed. Create the sequence file.
EXECUTE "CREATE.FILE SDKSequences 2 1 1"
Open "SDKSequences" TO SeqFile Else Ans = -1
End

* Attempt to read the named record from the file.
Readu NextVal From SeqFile, SequenceName Else
* No record by that name.
* Start new sequence at InitialValue.
NextVal = InitialValue
End
End

Ans = NextVal

* Increment the sequence value, and write back to file.
NextVal = NextVal + 1
Writeu NextVal On SeqFile, SequenceName Else Ans = -1



Programmer Analyst,
Cognizant,
Chennai.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

When you create a routine it is stored in the hashed file DS_ROUTINES in the repository.
To be compiled, the source code is copied into the DSU_BP directory, then it is compiled so that the object code resides in DSU_BP.O, after which the source code in DSU_BP is deleted.
It seems you cannot add an entry to the DSU_BP directory, which almost certainly is an operating system permissions issue.
Check the permissions on DSU_BP, and make sure your have rwx permissions (or "Full Control" if on a Windows platform).


Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
Post Reply