Routine hangs

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
Anthony1200
Premium Member
Premium Member
Posts: 28
Joined: Wed Mar 28, 2007 6:57 am
Location: Amsterdam

Routine hangs

Post by Anthony1200 »

Hi,

Ive made a simple routine that is supposed to unzip a file the code is:
Call DSExecute('DOS', '7z x ' : Filedir : '\' : ZipFile, Output, ReturnCode)
Ans = Output

But if I test this routine it just hangs :s
Got any idea's ?

Kind regards,
Anthony
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

If the "7z" program expects terminal input it won't return until it gets it, and DataStage won't supply it.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Meaning, it has stopped and is waiting for someone to say yes or no. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Anthony1200
Premium Member
Premium Member
Posts: 28
Joined: Wed Mar 28, 2007 6:57 am
Location: Amsterdam

Post by Anthony1200 »

Thanks guys,

Hmmm have you got any tips as to a windows version of something like gzip and gunzip ?? they always did the trick on AIX for me :p but I'm searching for some alternative that works :)

Kind regards,
Albert
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

There's always WinZip. Once you register it, from what I recall you can also download a command line interface for it. And I'd be shocked if the granddaddy of them all, pkzip, isn't still around.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

A useful trick

Post by ray.wurlod »

The NUL file (or /dev/null if you're on UNIX) can deliver an infinite number of "presses of Enter". Try something like the following if default answers are OK.

Code: Select all

Call DSExecute('DOS', '7z x ' : Filedir : '\' : ZipFile : " < .\NUL", Output, ReturnCode) 
Ans = Output
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Anthony1200
Premium Member
Premium Member
Posts: 28
Joined: Wed Mar 28, 2007 6:57 am
Location: Amsterdam

Post by Anthony1200 »

Hi,

Thankz a lot :) this NUL trick works!!
Speaking about null files, does this also work when u want a directory listing? in AIX i use a flatfile stage and then just put in:
/dev/null for the filename and use ls -l #variable# as a filter to get a record by record listing :) this trick does not work on windows :(

Kind regards,
Anthony
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That 'trick' should also work on Windows as long as you use the Windows NUL rather than the UNIX /dev/null equivalent, I would think.

There's also a command line 'manual' out there, probably at the main site but also found here:

http://prudentialscatterbrain.hp.infose ... /index.htm

This is for the command line switches but there's a link back to the main topic. I posted the URL to point out that there is a -y switch which says to "assume yes" to all questions, which should solve your original problem a little more... officially. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Anthony1200
Premium Member
Premium Member
Posts: 28
Joined: Wed Mar 28, 2007 6:57 am
Location: Amsterdam

Post by Anthony1200 »

Hi Chullet,

Thanks your are right! that switch also works :) nice :)
Ehm and about that \nul file if I use
\null for the filename and dir -b #variable# in the filter of a flatfile stage
I get an error that the \nul file cant be found (thats the whole point right? :p)

Thanks for all your help :)

Kind regards,
Anthony
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Get the pathname right. NUL file is in the folder; therefore the pathname is either NUL alone or .\NUL (the dot means "current folder") - not \NUL which means "the nul file in the root directory of the drive.
And, of course one L not two for Windows.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Anthony1200
Premium Member
Premium Member
Posts: 28
Joined: Wed Mar 28, 2007 6:57 am
Location: Amsterdam

Post by Anthony1200 »

Hi Ray thanks for the help :)

I tried and got this error message:
TestRegDir..SeqFile1.Dirfileresult: ds_seqopen() - Win32 error in CreateProcess() - The system cannot find the file specified.

I tried both .\NUL and NUL with filter dir -b c:\temp

Kind regards,
Anthony
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Why not put "c:\temp" as the filename and "dir -b" as the filter? Does that not work?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Anthony1200
Premium Member
Premium Member
Posts: 28
Joined: Wed Mar 28, 2007 6:57 am
Location: Amsterdam

Post by Anthony1200 »

Hi chulett thanks for your help :)
Unfortunately the flatfilestage keeps asking for an existing file :( the NUL file trick doesnt work like in UNIX or AIX based systems so it seems...

I can write a routine that puts the contens of a directory in a file and then read this file but this seems like "cruel" work around?

Kind regards,
Anthony
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Actually, that sounds like a pretty simple (and cruelty free) work around. Before job, issue the 'dir' command with the output redirected to a file and then read the output file in job.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply