George

Here's a very simple but very utility:

       PROGRAM SRUN
*
---------------------------------------------------------------------------
*  @@Name        : SRUN
*  @@Description : Run a command against each element of a select list
*  @@Version     : 1.0
*
---------------------------------------------------------------------------
*  Brief Description
*  -----------------
*  @@INFO {
*   Syntax SRUN Command {} params
*   where {} substitutes each select list entry in turn.
*   eg SELECT VOC WITH F1 LIKE F... AND WITH F2 UNLIKE .../...
*      SRUN RESIZE {} * * *
* }
*
---------------------------------------------------------------------------
*  Warnings
*  --------
*
*
---------------------------------------------------------------------------
*  Modification History
*  --------------------
*
---------------------------------------------------------------------------
* Keywords
* --------
* @@KEY UTILS,SRUN
* --------------------------------------------------------------------------
* To Do List
* ----------
*
* --------------------------------------------------------------------------
$OPTIONS PICK

       Open '&SAVEDLISTS&' To Sl Else
          Print 'Cannot Open Saved Lists File'
          Stop
       End

       ProgramName = "SRUN"

       TCL = @Sentence
       Locate ProgramName In Convert(" ",@FM, TCL ) Setting Pos Then
          RestOfLine = TCL[" ",Pos+1, Len(TCL)]
       End Else
          RestOfLine = ''
       End

       If RestOfLine = '' Then
          GoSub Usage
          STOP
       End

       Ix = Index(RestOfLine,"{}",1)
       If Not(Ix) Then
          Crt 'no include specification'
          STOP
       end


       ReadList List Else
          Crt 'No items Selected'
          STOP
       End

       Loop
          Remove Id from List Setting DVAR
          Command = Change(RestOfLine,"{}",Id)
          Crt Command
          Execute Convert(";",@FM,Command)
       While DVAR Do
       Repeat

       STOP

*---------------------------------------------------------------------------
* Usage
*---------------------------------------------------------------------------
Usage:  

       Crt 'SRUN - Run a Command against a select list'
       Crt 'Syntax - SELECT nnnn'
       Crt 'SRUN Command {} ...'
       Crt '{} substitutes the select list element'
       Crt
       Crt 'Example:'
       Crt ' > SELECT VOC WITH F1 LIKE F...'
       Crt ' >>SRUN LIST {} '
       Crt
       Crt 'Multiple commands can be specified semicolon delimited'
       Crt

       Return


 

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of George Gallen
Sent: 10 December 2009 7:03 PM
To: U2 Users List
Subject: [U2] A readnext within a VOC?

I'd like to setup a VOC to select a list, then run  a program for each entry
in the list (like below...)

PA
GET-LIST LISTNAME
LOOP
     READNEXT ID ELSE EXIT
     DATA ID
     RUN LIB PROGRAMNAME
REPEAT

I Thought there was a way to do this...but just can't remember how.

In the meantime, I pass the list to another program (on another channel)
which reads each item
   and EXECUTEs the PROGRAMNAME


George Gallen
Senior Programmer/Analyst
Accounting/Data Division, EDI Administrator ggal...@wyanokegroup.com
ph:856.848.9005 Ext 220
The Wyanoke Group
http://www.wyanokegroup.com



_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.709 / Virus Database: 270.14.102/2556 - Release Date: 12/10/09
07:36:00

_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to