PDA

View Full Version : IFS-Command(s)



Anderer, Ludwig
07-01-10, 14:19
Hallo I-Series -Kollegen

Ich suche nach einem Command(s), mit dem man im IFS die Existenz einer PC-Datei feststellen kann, um diese vor einer erneuten Übertragung umzubennen bzw. zu löschen.

Besten Dank schon einmal
L.Anderer

cs400_de
07-01-10, 14:26
Hallo,

QSYS/RNM OBJ('/ich') NEWOBJ('wir')

führt zur Meldung CPFA0A9
Nachricht . . . : Objekt nicht gefunden. Das Objekt ist /ich.

wenn das Objekt nicht da ist.

Gruß

C.Schulz

prsbrc
07-01-10, 14:29
Hallo.
Da fällt mir jetzt spontan ein primitives CLP ein welches mittels Test so alá CPYTOIMPF oä und einem MONMSG die alte Datei umbenennt oder löscht bevor die neue Übertragen oder erstellt wird.

Das ist aber eine der vielen Möglichkeiten um sowas zu bewerkstelligen.

Edit: Sorry... Da war wohl wer schneller als ich *gg*

Lg
Christian Brunner

Anderer, Ludwig
07-01-10, 14:36
Danke für die schnelle Nachricht !

L.A.

Pikachu
07-01-10, 15:55
Oder mit CHKOUT und anschließendem CHKIN, falls der CHKOUT funktioniert hat.

BenderD
08-01-10, 08:30
das C API access ist dein Freund (Beispiel ist in meinen OpenSource Komponenten zu finden)

D*B


Hallo I-Series -Kollegen

Ich suche nach einem Command(s), mit dem man im IFS die Existenz einer PC-Datei feststellen kann, um diese vor einer erneuten Übertragung umzubennen bzw. zu löschen.

Besten Dank schon einmal
L.Anderer

kitvb1
12-01-10, 07:59
1. Scott Klement wrote an article (SystemiNetwork) with the code included in which he described how to create an SQL UDTF which returns all the objects in a directory. This means that one can just run an sql statement and voila!, you have a list. As is usual with Mr. Klements' stuff, it's brilliant. I've tested this and it works very well. I've also modded it a bit in that the directory can be passed as a parameter. But it is slow, due to a) It's IFS and b) you have to continually open and close the SQL cursor for each directories/sub-directory.

2. This article and the subsequent testing made me think more about this and came up with the following. What you can also use is the QSH commands and list the contents of a directory (and optionally all sub-directories) to STDOUT. Now you could parse through the output but that's tiresome. Again using SQL (and views), you can now display your list. But the drawback on this way is that it's not real-time. You must refresh the list continually. On the upside, you are not continually opening & closing the SQL cursor for each directory.

Hope this helps.

malzusrex
12-01-10, 08:12
Hatte da mal ein kleine RPG gemacht


H Option( *SrcStmt ) DftActGrp( *No ) BndDir( 'QC2LE' )
h datfmt(*dmy.) timfmt(*hms:) datedit(*dmy.) decedit('0,') debug(*yes)
*
* CHK_IFS- Testen ob die Datei im IFS schon da ist
*


d File s *
d
d PM_File s 255
d PM_Return s n
d
d True c *On
d False c *Off
d
*-- IFS stream file functions: -----------------------------------**
d open Pr * ExtProc( '_C_IFS_fopen' )
d * Value Options( *String )
d * Value Options( *String )

c *Entry PList
c Parm PM_File
c Parm PM_Return
c
C Eval File = Open( %Trim( PM_File )
C : 'r' )
**
C If File = *Null
C Eval PM_Return = False
C Else
C Eval PM_Return = True
c EndIf
c
c Eval *InLr = True



Gruß Ronald

Fuerchau
12-01-10, 10:08
Das Problem beim Open ist, dass Zugriffszeiten aktualisiert werden.

Ausserdem solltest du den Close nicht vergessen, da hier die Ressourcen nicht automatisch freigegeben werden!
Wenn du das häufiger in einem Job machst, gehen dir die Ressourcen irgendwann aus.
"Access()" ist da besser.

malzusrex
12-01-10, 11:42
Okay, Danke
Wieder was dazu gelernt!