cancel
Showing results for 
Search instead for 
Did you mean: 

OS command

Former Member
0 Kudos

Can some one give me an example for OS command in file adapter.

i need exampled.

Accepted Solutions (1)

Accepted Solutions (1)

former_member183906
Active Contributor
0 Kudos

Hii Harsha..

If you need or want to execute specific OS command via FTP you can use this guide:

http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/rzaiq/rzaiqrcmd.htm

But the support of OS command depends from with FTP server you are connecting to.

You need to write Shell script for this kind of requirement,

There is a split command available

SPLIT -- Split a file into fixed-size pieces

Refer below pdf for reference commands

http://www.maths.dundee.ac.uk/software/OSXcommands.pdf

Please see the below links

Answers (7)

Answers (7)

hemant_chahal
Contributor
0 Kudos

You can try with this commmand

with your receiver adapter where your file name comes with counter

and prefix as e.g. "abc".

this command will extract the filename starting only with abc and you can then move that file into any folder you want or simple you can generate a file name in name.txt.

save this command as bat file and give path in your in NFS file adapter and after processing.

@echo off

for /F %%a in ('dir /b abc.') do set FileName=%%~nxa

echo %FileName%>name.txt

former_member192295
Active Contributor
0 Kudos

Hi,

Generally these functions are used to operate before & after adapter process. i.e most of the cases before adapter process need to merge two files into one file, in this scenario we will choose process before command. After process target file need to move to some other folder that time we will choose process after command.

Most of the time OS commands will use when adapter function will work either before or after.

Find below link for more help

Former Member
0 Kudos

hi

check the below blogs

OS COMMAND

Executing Unix shell script using Operating System Command in XI

Performing FTP Commands From ABAP

Glimpse at OS command

regards

kummari

Former Member
0 Kudos

One more usage of OS command, calling shell script from Adapter..check this blog

thanks

Prabhakar

Former Member
0 Kudos

hi,

Try doing it using UDF's.

smthng like this .

import java.io.File;

import java.io.BufferedReader;

import java.io.InputStreamReader;

public class RunSystemCommand {

public static void main(String args[]) {

String s = null;

// system command to run

String cmd = "copy a.txt b.txt";

// set the working directory for the OS command processor

File workDir = new File("c:

temp");

try {

Process p = Runtime.getRuntime().exec(cmd, null, workDir);

int i = p.waitFor();

if (i == 0){

BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));

// read the output from the command

while ((s = stdInput.readLine()) != null) {

System.out.println(s);

}

}

else {

BufferedReader stdErr = new BufferedReader(new InputStreamReader(p.getErrorStream()));

// read the output from the command

while ((s = stdErr.readLine()) != null) {

System.out.println(s);

}

}

}

catch (Exception e) {

System.out.println(e);

}

}

}

Regards.

Siddhesh Naik

Former Member
0 Kudos

In these blogs you have examples for OS command:

Former Member
0 Kudos

Please search the blogs section of SDN with the string "OS command"

Thanx

Aamir