using @USER0 in Sequential stage file name
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 27
- Joined: Sun Mar 20, 2005 4:23 am
- Location: Brisbane, Australia
using @USER0 in Sequential stage file name
I know you can use job parameters in a Sequential file stage filename eg:
#$EXTRACTS#\#CONNECTORSCRIPTNAME#_#RICEF# REJECTED.csv
Is there a way to use @USER0 in the Filename of a Sequential file stage?
#$EXTRACTS#\#CONNECTORSCRIPTNAME#_#RICEF# REJECTED.csv
Is there a way to use @USER0 in the Filename of a Sequential file stage?
-
- Participant
- Posts: 27
- Joined: Sun Mar 20, 2005 4:23 am
- Location: Brisbane, Australia
Search the forum for macros, or consider writing out a standard file name and then using an after-routine to rename the file. That gives you a powerful option.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
I usually write to a standard name and change it in an after-stage or after-job subroutine. To use @USER0 you would need to craft your own routine, but the logic is straightforward. If, for example, the file is in the current (project) directory, you can use &UFD& as a Type 19 UniVerse file. Otherwise, generate an appropriate operating system command.
Code: Select all
SUBROUTINE ChangeFileName(InputArg, ErrorCode)
* InputArg is pathname of file to change name
* Name change appends value of @USER0
CALL !GET.PATHNAME(InputArg, DirPath, EntryName, Code)
NewName = EntryName : @USER0 ; * adapt to suit
If System(91)
Then
Command = "REN " : InputArg : " " : NewName
Shell = "DOS"
End
Else
Command = "mv " : InputArg : " " : NewName
Shell = "UNIX"
End
Call DSExecute(Shell, Command, Output, ExitStatus)
RETURN
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 27
- Joined: Sun Mar 20, 2005 4:23 am
- Location: Brisbane, Australia
-
- Participant
- Posts: 27
- Joined: Sun Mar 20, 2005 4:23 am
- Location: Brisbane, Australia
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Park it anywhere from the routine, for example the job's user status area. This is readily accessed as an "activity variable" in a job sequence. But you could just as easily write it (the filename) into a text file or a database table or hashed file.
Code: Select all
SUBROUTINE ChangeFileName(InputArg, ErrorCode)
* InputArg is pathname of file to change name
* Name change appends value of @USER0
CALL !GET.PATHNAME(InputArg, DirPath, EntryName, Code)
NewName = EntryName : @USER0 ; * adapt to suit
If System(91)
Then
Command = "REN " : InputArg : " " : NewName
Shell = "DOS"
End
Else
Command = "mv " : InputArg : " " : NewName
Shell = "UNIX"
End
Call DSExecute(Shell, Command, Output, ExitStatus)
* Generate full pathname of new file name and write to user status area
Call !MAKE.PATHNAME(DirPath, NewName, NewPath, Code)
Call DSSetUserStatus(NewPath)
RETURN
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.