Search Options
Skip to main content (Press Enter).
Sign in
Skip auxiliary navigation (Press Enter).
Skip main navigation (Press Enter).
Toggle navigation
Search Options
Home
Forums
All Forums
My Forums
IBM i
IBM zSystems
MultiValue
Uniface
Browse
Help/FAQs
All Discussion Posts
Blog Posts
Announcements
Digital Disrupted Podcast
Getting Started
Join the Forum
Rocket U2 | UniVerse & UniData
View Only
Sub-Forum Home
Threads
3.1K
Members
654
Back to {0}
UNIVERSE COPY/MOVE Binary Files using UNIBASIC
Jump to
Best Answer
Thread closed by the administrator, not accepting new replies.
Add a tag
x
User Tags may not contain the following characters: @ # $ & :
Aaron Glover
posted 07-05-2021 08:33
Hi All
Assuming I have appropriate permissions on the file system can anyone tell me if it is possible to copy/move from a UNIBASIC program?
I have explored READBLK and WRITEBLK but the file always seems to be corrupt after writing.
Example scenario; move/copy a word doc or PDF file from one directory to another.
Alternatively is there a way to shell execute a command to the local server or execute a powershell command etc.
Thanks In Advance
Aaron
ROCKETEER
Jonathan Smith
posted 07-05-2021 08:40
Best Answer
Aaron,
Why not use the EXECUTE command to execute a shell level command.
For Windows EXECUTE " DOS /c 'copy xxx xxx' "
For UNIX EXECUTE " sh -c 'cp xxxxx xxxx' "
Thanks,
Jonathan
David Green
posted 07-05-2021 08:43
Aaron, looks like you are using UniVerse. I don't remember my UniVerse days very well. But in UniData before doing any binary reads/writes I would always use NOCONVERT to stop the conversion of null. To execute an OS command from UniBasic I would always use PCPERFORM or start my command with a ! character.
ROCKETEER
Jonathan Smith
posted 07-05-2021 08:47
@David Green
NOCONVERT is not available in UniVerse.
PCPERFORM is also not available in UniVerse.
For UniVerse to run a shell command is 'DOS /c' on Windows and 'sh -c' for Unix but the command has to enclosed in single quotes.
PARTNER
Manu Fernandes
posted 07-05-2021 08:54
Hello
Best practice is a os statement.
On windows use 'DOS /C stmt' it start a cmd.exe and execute stmt.
on Unix use 'SH-c statement' it start a SH and execute stmt.
I hope this help
Aaron Glover
posted 07-05-2021 09:21
Thanks all.
I was never aware i could use EXECUTE() to run a dos command. A cursory glance at the Unibasic Command Reference doesnt give any hint that I can do as suggested and execute a DOS command.
And to clarify; yes I am using Universe on Windows.
Thanks Again.
Copyright 2022. All rights reserved.
Powered by Higher Logic