IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

how to write output records without a key from input file??


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
italo_pm

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Wed May 20, 2015 5:40 pm
Reply with quote

hi, i'm a problem with a logical code... i'm new in rexx code..

i can not think a code to "extract" a record without a key... for sample i write a rexx to extract records in my output was from colum 1 to 3 = VFY (the key) ... but now i want write in my output the rest records... there without VFY...

can you help me, please...

input...

Code:

VFY APP      RESPONS        AREA
VFY WIAX8    name surname   AUTO.TEST
VFY WIAX8    name surname.  AUTO.TEST
VFY WIAX8    name.surname   AUTO.TEST
VFY= FB
                                                                           
==============================================
Description : APP WIAX8                                                         
*********************************************************** 
JOBNAME*   *DESCRIPTION JOB      
************************************************************       
WIAX8PPR   WIAX8PPR start
WIAX8P05   WIAX8P05 exec
WIAX8P10   WIAX8P10 exec       
WIAX8P15   WIAX8P15 exec script .sh
WIAX8P20   WIAX8P20 exec script .sh        
WIAX8P25   WIAX8P25 exec script.sh
WIAX8P30   WIAX8P30 exec script .sh      
WIAX8P35   WIAX8P35 exec script .sh
WIAX8TSX   WIAX8TSX end

 


i want output this:

Code:

==============================================
Description : APP WIAX8                                                         
*********************************************************** 
JOBNAME*   *DESCRIPTION JOB      
************************************************************       
WIAX8PPR   WIAX8PPR start
WIAX8P05   WIAX8P05 exec
WIAX8P10   WIAX8P10 exec       
WIAX8P15   WIAX8P15 exec script .sh
WIAX8P20   WIAX8P20 exec script .sh        
WIAX8P25   WIAX8P25 exec script.sh
WIAX8P30   WIAX8P30 exec script .sh      
WIAX8P35   WIAX8P35 exec script .sh
WIAX8TSX   WIAX8TSX end

 


thanks for your help.

regards.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed May 20, 2015 5:58 pm
Reply with quote

Have you looked at a list of any Rexx functions? substr comes to mind.
Back to top
View user's profile Send private message
italo_pm

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Wed May 20, 2015 6:40 pm
Reply with quote

thanks for answer,

my problem is these, i don't know when use a substr or maybe use a IF NOT EQUAL A VFY, how to apply a code or when.....

thanks again.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed May 20, 2015 6:54 pm
Reply with quote

Write the program to write the records when equal VFY.

Then it is a very small change to get the not equal records.
Back to top
View user's profile Send private message
italo_pm

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Wed May 20, 2015 6:59 pm
Reply with quote

ok, i'm search information about IF NOT EQUAL to use , in the forum and google.. ... update your later

thanks again
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed May 20, 2015 7:18 pm
Reply with quote

a simple sort copy with the OMIT control statement would more than enough

lots of rexx snippets around,
you will have to be careful, too many of them are really BAD
Back to top
View user's profile Send private message
italo_pm

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Wed May 20, 2015 9:50 pm
Reply with quote

thanks Enrico, i exec a sort with omit, works but i'm exec this sort for all members in library (10000 members) one by one it's a problem... with a rexx (my rexx with colum 1 to 3 = VFY in one exec extract records) because use a list members. .. in this case with only a sort code how to exec for all members in library??

any suggestions please?? i want use a rexx for not have any problems...

thanks aagain.
Back to top
View user's profile Send private message
italo_pm

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Thu May 21, 2015 10:15 am
Reply with quote

hi again,

in this rexx exclude records with start (1,3) = VFY (/= 'VFY') and write fileout data ...

input

Code:
 VFY APP      RESPONS                    AREA            CRITICA   CELL
 VFY WIAX8    name lastname              AUTO.TEST       NO
 VFY WIAX8    name lastname 2            AUTO.TEST1      NO
 VFY= CAMPO FISSO

 ========================================================================
 Description : APP WIAX8
 ======================================================================
 ***********************************************************************
 JOBNAME* *DESCRIPTION JOB         *                *CLASS* *RC**RESTART*
 ************************************************************************
 WIAX8PPR   WIAX8PPR                        WIAX8PPR   0     00   JOB
 WIAX8P01   WIAX8P01 DESCRIPTION script     WIAX8P01   0           NO
 WIAX8P02   WIAX8P02 DESCRIPTION script     WIAX8P02   0           NO
 WIAX8P03   WIAX8P03 DESCRIPTION script     WIAX8P03   0           NO


output

Code:
 ========================================================================
 Description : APP WIAX8
 ======================================================================
 ***********************************************************************
 JOBNAME* *DESCRIPTION JOB         *                *CLASS* *RC**RESTART*
 ************************************************************************
 WIAX8PPR   WIAX8PPR                        WIAX8PPR   0     00   JOB
 WIAX8P01   WIAX8P01 DESCRIPTION script     WIAX8P01   0           NO
 WIAX8P02   WIAX8P02 DESCRIPTION script     WIAX8P02   0           NO
 WIAX8P03   WIAX8P03 DESCRIPTION script     WIAX8P03   0           NO


this is a rexx...


Code:
/* REXX */                                                       
 /* lib input */                                                 
   libreria  = 'MY.LIB.INPUT'                       
/* list members  */                                             
A = OUTTRAP('MEMBLIST.')                                         
"LISTDS '"libreria"' MEMBERS"                                   
A = OUTTRAP(OFF)                                                 
                                                                 
out = 0                                                         
DO i = 7 TO memblist.0 /* start record 7 */                     
   membro = STRIP(memblist.i)                                   
   /* alloc member */                                           
   "ALLOC FILE(MEMBER) DSNAME('"libreria'('membro')'"') SHR"     
   IF rc <> 0 THEN DO                                           
   /* if error */                                               
      SAY 'Error open membro' libreria'('membro')'               
      EXIT                                                       
   END                                                           
     "EXECIO * DISKR MEMBER (STEM LINEA." /* read member */     
    SAY 'start exec membro: 'membro                             
   DO in=1 to linea.0 /* start record 1 */                       
                                                                 
      IF SUBSTR(linea.in,1,3) /= 'VFY' THEN DO                   
         appinfo = SUBSTR(linea.in,1,120) /* records to save */ 
         out = out+1                                             
         fappinfo.out = appinfo                                 
         fappinfo.0   = out                                     
      END                                                       
   END                                                           
                                                                 
    SAY 'end exec membro  : 'membro                             
                                                                 
   "EXECIO 0 DISKR MEMBER (FINIS" /* close member  */           
   "FREE FILE(MEMBER)"                                           
END                                                             
                                                                 
/* FILEOUT DD JCL */                                             
"EXECIO * DISKW fappinfo (FINIS STEM fappinfo."                 
    SAY 'last member: 'membro                                   
    SAY 'records write: 'out /* total records */                 
                                                                 
 EXIT                                                           
                                                                 



but my fileout (fappinfo) write all records from all members from my input library in one fileout (i'm declaration in jcl step),

but i want create one fileout (DS) for each member ...

for sample...

Z99.Z99REXX.MYREXX.FAPPINFO._membername

how to separate, create dataset and concatenation the name dataset + with member name for each member in rexx code??

any ideas?

thanks for your help.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu May 21, 2015 10:44 am
Reply with quote

So your input is 10000 members and you want to create 10000 output datasets. I guess some people will not be happy about that.
Back to top
View user's profile Send private message
italo_pm

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Thu May 21, 2015 11:25 am
Reply with quote

hi, thanks for answer,

- each member have 50 lines max...
- the first time exec the rexx is to refresh/allineate a backup library app tws information office , then i not think exec more
- dataset after exec rexx deleting from jcl, because output merge to another dataset to create one member with information update..

thanks for your point, i talk with operator and schedule group.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu May 21, 2015 1:41 pm
Reply with quote

probably there was a misunderstanding in the requirement,
nobody would want to create 10000 datasets

this works ( TESTED )
to create the cleaned up members in another pds

Code:

/* rexx */
 
/*  input / output
*/
ipds = "ENRICO.IPDS"
opds = "ENRICO.OPDS"
 
/*  list members
*/
z = outtrap('mbrs.')
Address TSO "LISTDS '"ipds"' MEMBERS"
z = outtrap(off)
 
/*  skip the first useless lines of LISTDS
*/
do m = 7 to mbrs.0
    odata.0 = 0
    mbr = strip(mbrs.m)
 
    Address TSO "alloc file(idd) dsname('"ipds"("mbr")' ) shr reuse"
    if rc /= 0 then do
        say "alloc error("rc") for dataset'"ipds"("mbr")' "
        iterate m
    end
 
    Address TSO "execio * diskr idd (stem idata. finis"
    if rc /= 0 then do
        say "EXECIO error("rc") for dataset'"ipds"("mbr")' "
        iterate m
    end
 
    do  i=1 to idata.0
        if  translate(left(idata.i,3)) /= "VFY" then do
            o = odata.0+1
            odata.o = idata.i
            odata.0 = o
        end
    end
 
    Address TSO "alloc file(odd) dsname('"opds"("mbr")' ) shr reuse"
    if rc /= 0 then do
        say "alloc error("rc") for '"opds"("mbr")'"
        iterate m
    end
 
    Address TSO "execio "odata.0" diskw odd (stem odata. finis "
    if rc /= 0 then do
        say "EXECIO error("rc") for dataset'"opds"("mbr")' "
    end
end
exit



just use the proper dataset names,
and, naturally, allocate an empty output PDS
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu May 21, 2015 2:01 pm
Reply with quote

Quote:
but i want create one fileout (DS) for each member ...


Nice rexx Enrico, I see a problem with the number of dynamic allocations.
Maybe a "FREE" here and there could prevent dynamic allocation problems.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu May 21, 2015 2:29 pm
Reply with quote

Quote:
Maybe a "FREE" here and there could prevent dynamic allocation problems.


unless I am having a brain check
ALLOC with the reuse clause should take care of that ...
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu May 21, 2015 2:45 pm
Reply with quote

faster to test than read the manuals

did not have any problems with ...

Code:

 EDIT       ENRICO.ISPF.EXEC(STRESSPD) - 01.02              Columns 00001 00072
 Command ===>                                                  Scroll ===> CSR
 ****** ***************************** Top of Data ******************************
 000001 /* rexx */
 000002
 000003 /*  input / output
 000004 */
 000005 opds = "ENRICO.TEST.STRESSPD"
 000006 do m = 1 to 5000
 000007     mbr = "mbr"right(m,4,"0")
 000008
 000009     Address TSO "alloc file(odd) dsname('"opds"("mbr")' ) shr reuse"
 000010     if rc /= 0 then do
 000011         say "alloc error("rc") for '"opds"("mbr")'"
 000012         exit
 000013     end
 000014     odata.1 = "some useless data for " mbr
 000015     Address TSO "execio 1 diskw odd (stem odata. finis "
 000016     if rc /= 0 then do
 000017         say "EXECIO error("rc") for dataset'"opds"("mbr")' "
 000018         exit
 000019     end
 000020 end
 000021 exit
 ****** **************************** Bottom of Data ****************************
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu May 21, 2015 2:59 pm
Reply with quote

Ok, Enrico. Thanks.
Back to top
View user's profile Send private message
italo_pm

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Thu May 21, 2015 3:56 pm
Reply with quote

thanks for answer, and thanks Enrico for you time and rexx code, i'm test as soon as possible.

but perhaps I have not explained well, i want create for each member process one dataset sequential (not member in another library) with name (for sample)

dataset ==> Z99.MYREXX.MYOUTPUT._MEMBER-PROCESS-NAME

where _MEMBER-PROCESS-NAME is a member name..

it's possible?

thanks again
regards.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu May 21, 2015 6:04 pm
Reply with quote

possible yes, wise NOT

Quote:
each member have 50 lines max...


do You, Your support realise the waste of disk space ?
the minimum allocation is one track, even to store only 50 record of 120 bytes
resulting in a dasd utilisation of ... 10.75 % ( really bad )
Back to top
View user's profile Send private message
italo_pm

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Thu May 21, 2015 6:15 pm
Reply with quote

thanks for answer and suggest Enrico, i'm use a PDS to save a member...


all members contain information about application in tws, name,owner,note.

now exist 2 library, official libray and backup, i want update library (new library) with new position colum and data info. after create a new library , delete library backup.
Back to top
View user's profile Send private message
italo_pm

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Fri May 22, 2015 12:08 pm
Reply with quote

thanks Enrico, i'm test, work fine, thanks again...

now, i want create another members in other library for input a first records and then concatenate with this members...

- with your rexx code extract a data information OPINFORM
- with next rexx extract owner information OPOWNERM....

after i want concatenate 2 fileout i one member..

this is my input, for each member verify the name (columns 1-12) and then copy line by line and create a new member with a name

input file: INPOWNER

Code:

VFY APP      OWNER           AREA CRITICA CELL
VFY A31DG    name surname 1  TEST NO
VFY A31DG    name surname 2  TEST NO
VFY B7010    name surname 1  TEST NO
VFY B7010    name surname 2  TEST NO
VFY WIAX8    name surname 1  TEST NO
VFY WIAX8    name surname 2  TEST NO



this a rexx

Code:
 /* rexx */                                                                     
                                                                               
 /*  input / output                                                             
 */                                                                             
 ipds = "MYLIB.SCRIPT.TEXT.INPUT"                                             
 opds = "MYLIB.SCRIPT.TEXT.OUTPUT"                                           
                                                                               
 /*  list members                                                               
 */                                                                             
 z = outtrap('mbrs.')                                                           
 Address TSO "LISTDS '"ipds"' MEMBERS"                                         
 z = outtrap(off)                                                               
                                                                               
 /*  skip the first useless lines of LISTDS                                     
 */                                                                             
 do m = 7 to mbrs.0                                                             
     odata.0 = 0                                                               
     mbr = strip(mbrs.m)                                                       
                                                                               
     Address TSO "alloc file(idd) dsname('"ipds"("INPOWNER")' ) shr"           
     if rc /= 0 then do                                                         
         say "alloc error("rc") for dataset'"ipds"("INPOWNER")' "               
        iterate m                                                               
    end                                                                         
                                                                               
    Address TSO "execio * diskr idd (stem idata. finis"                         
    if rc /= 0 then do                                                         
        say "EXECIO error("rc") for dataset'"ipds"("INPOWNER")' "               
        iterate m                                                               
    end                                                                         
                                                                               
    do  i=1 to idata.0                                                         
        if  translate(left(idata.i,12)) = "VFY" mbr then do                     
            appinfo = SUBSTR(idata.i,1,120)                                     
            o = odata.0+1                                                       
            odata.o = appinfo                                                   
            odata.0 = o                                                         
            say 'VFY APP      OWNER                       AREA        CRITICA 
CELL'                                                                           
            SAY  appinfo                                                       
        end                                                                     
    end                                                                         
                                                                               
    Address TSO "alloc file(odd) dsname('"opds"("mbr")' ) shr reuse"           
    if rc /= 0 then do                                                         
        say "alloc error("rc") for '"opds"("mbr")'"                             
        iterate m                                                               
    end                                                                         
                                                                               
    Address TSO "execio "odata.0" diskw odd (stem odata. finis "               
    if rc /= 0 then do                                                         
        say "EXECIO error("rc") for dataset'"opds"("mbr")' "                   
    end                                                                         
end                                                                             
    SAY 'end - exit'                                                           
exit                                                                           
                                                                               


my output is:

member A31DG

Code:


VFY A31DG    name surname 1  TEST  NO
VFY A31DG    name surname 2  TEST  NO



member B7010

Code:


VFY B7010    name surname 1  TEST  NO
VFY B7010    name surname 2  TEST  NO



but, how to for each member created in the first line add this:

Code:


VFY APP    OWNER    AREA   CRITICA CELL




result desired:


member A31DG


Code:

VFY APP      OWNER           AREA CRITICA CELL
VFY A31DG    name surname 1  TEST NO
VFY A31DG    name surname 2  TEST NO



any suggestions please, thanks for all
Back to top
View user's profile Send private message
italo_pm

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Sat May 23, 2015 10:27 am
Reply with quote

hi everyone, i modified rexx code to concatenate one record for each member on top

i'm use

MAKEBUF (read on documentation ibm)

Queue 'VFY APP OWNER AREA CRITICA CELL'
...
...
...
...
...
Queue appowner
Address TSO "execio "QUEUED()" diskw oddow (finis "
DROPBUF

rexx works fine,

rexx code

Code:

/*  REXX  */
/*----------------------------------------------------------------------------*/
/*  input / output
*/
ipds = "MYLIB.SCRIPT.TEXT.INPUT"
opds = "MYLIB.SCRIPT.TEXT.OUTPUT"

/*  list members
*/
z = outtrap('mbrs.')
Address TSO "LISTDS '"ipds"' MEMBERS"
z = outtrap(off)

/*  skip the first useless lines of LISTDS
*/
do m = 7 to mbrs.0
    odataow.0 = 0
    mbr = strip(mbrs.m)

    Address TSO "alloc file(iddow) dsname('"ipds"("INPOWNER")' ) shr"
    if rc /= 0 then do
        say "alloc error("rc") for dataset'"ipds"("INPOWNER")' "
        iterate m
    end

    Address TSO "execio * diskr iddow (stem idataow. finis"
    if rc /= 0 then do
        say "EXECIO error("rc") for dataset'"ipds"("INPOWNER")' "
        iterate m
    end
/*----------------------------------------------------------------------------*/
/* first record - Queue start
*/
    MAKEBUF
    Queue 'VFY APP      OWNER                       AREA        CRITICA  CELL'
/*----------------------------------------------------------------------------*/
    do  i=1 to idataow.0
        if  translate(left(idataow.i,12)) = "VFY" mbr then do
            appowner = SUBSTR(idataow.i,1,120)
            oow = odataow.0+1
            odataow.oow = appowner
            odataow.0 = oow
            Queue appowner
        end
    end

    Address TSO "alloc file(oddow) dsname('"opds"("mbr")' ) shr reuse"

    if rc /= 0 then do
        say "alloc error("rc") for '"opds"("mbr")'"
        iterate m
    end

    Address TSO "execio "QUEUED()" diskw oddow (finis "
/*  Address TSO "execio "odataow.0" diskw oddow (stem odataow. finis " */
/*----------------------------------------------------------------------------*/
/* Queue end
*/
    DROPBUF
/*----------------------------------------------------------------------------*/
    if rc /= 0 then do
        say "EXECIO error("rc") for dataset'"opds"("mbr")' "
    end
end
    SAY 'end - exit'
exit
               


my input:

Code:
VFY APP      OWNER           AREA CRITICA CELL
VFY A31DG    name surname 1  TEST NO
VFY A31DG    name surname 2  TEST NO
VFY B7010    name surname 1  TEST NO
VFY B7010    name surname 2  TEST NO
VFY WIAX8    name surname 1  TEST NO
VFY WIAX8    name surname 2  TEST NO


my output:

member A31DG

Code:
VFY APP      OWNER           AREA CRITICA CELL
VFY A31DG    name surname 1  TEST NO
VFY A31DG    name surname 2  TEST NO


member B7010

Code:
VFY APP      OWNER           AREA CRITICA CELL
VFY B7010    name surname 1  TEST NO
VFY B7010    name surname 2  TEST NO


member WIAX8

Code:
VFY APP      OWNER           AREA CRITICA CELL
VFY WIAX8    name surname 1  TEST NO
VFY WIAX8    name surname 2  TEST NO


thanks for your help, i think change again the rexx to add information data in concatenate with another Queue

for sample:

my input, information data on member WIAX8

Code:
========================================================================
Description : APP WIAX8
======================================================================
***********************************************************************
JOBNAME* *DESCRIPTION JOB         *                *CLASS* *RC**RESTART*
************************************************************************
WIAX8PPR   WIAX8PPR                        WIAX8PPR   0     00   JOB
WIAX8P01   WIAX8P01 DESCRIPTION script     WIAX8P01   0           NO
WIAX8P02   WIAX8P02 DESCRIPTION script     WIAX8P02   0           NO
WIAX8P03   WIAX8P03 DESCRIPTION script     WIAX8P03   0           NO
WIAX8P04   WIAX8P04 DESCRIPTION script     WIAX8P04   0           NO
WIAX8P05   WIAX8P05 DESCRIPTION script     WIAX8P05   0           NO


thanks again.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sat May 23, 2015 10:56 am
Reply with quote

instead of complicating things with makebuf and friends
would' t have been faster to ...

odataow.0 = 1
odataow.1 = "VFY APP OWNER AREA CRITICA CELL"

and forget about MAKEBUF, QUEUE, EXECIO QUEUED, DROPBUF

and why the useless assignment to appowner ?

the useless complication makes the script more difficult to understand
Back to top
View user's profile Send private message
italo_pm

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Tue May 26, 2015 1:24 am
Reply with quote

hi, thanks for answer,

you are right Enrico, i'm change a rexx code

- delete MAKEBUF, QUEUED, DROPBUF

- add

odataow.0 = 1
odataow.1 = "VFY APP OWNER AREA CRITICA CELL"

- and delete assignment appowner var...

- add idatainf to record from data (information) member...

- and in diskw write 2 var (odataow, odatainf) in one output

Address TSO "execio "odataow.0" diskw oddow (stem odataow."
Address TSO "execio "odatainf.0" diskw oddow (stem odatainf. finis "

the rexx


Code:

/*  REXX  */                                                                                                       
/*-----------------------------------------------------------------------------------------------*/               
/*- start - */                                                                                                     
/*- add record block:                                                                           -*/               
/*  VFY APP     RESPONSABILE                             AREA                CRITICA        CELL                 
*/                                                                                                                 
                                                                                                                   
/*- add info owner:  (NEW DATA: member INPOWNER) include = "VFY"                                                   
*/                                                                                                                 
                                                                                                                   
/*- add info data: (not data change, only add for each member - exclude /= "VFY"                                   
*/                                                                                                                 
/*-----------------------------------------------------------------------------------------------*/               
/*  input / output                                                                                                 
*/                                                                                                                 
ipds = "MYLIB.SCRIPT.TEXT.INPUT"                                                                                   
opds = "MYLIB.SCRIPT.TEXT.OUTPUT"                                                                                 
                                                                                                                   
/*  list members                                                                                                   
*/                                                                                                                 
z = outtrap('mbrs.')                                                                                               
Address TSO "LISTDS '"ipds"' MEMBERS"                                                                             
z = outtrap(off)                                                                                                   
                                                                                                                   
/*  skip the first useless lines of LISTDS                                                                         
*/                                                                                                                 
do m = 7 to mbrs.0                                                                                                 
/*  odataow.0 = 0 */                                                                                               
    odataow.0 = 1                                                                                                 
    odataow.1 = "VFY APP     RESPONSABILE                             AREA                CRITICA        CELL"   
    mbr = strip(mbrs.m)                                                                                           
                                                                                                                   
/*- add info owner:  (NEW DATA: member INPOWNER) */                                                               
                                                                                                                   
    Address TSO "alloc file(iddow) dsname('"ipds"("INPOWNER")' ) shr"                                             
    if rc /= 0 then do                                                                                             
        say "alloc error("rc") for dataset'"ipds"("INPOWNER")' "                                                   
        iterate m                                                                                                 
    end                                                                                                           
                                                                                                                   
    Address TSO "execio * diskr iddow (stem idataow. finis"                                                       
    if rc /= 0 then do                                                                                             
        say "EXECIO error("rc") for dataset'"ipds"("INPOWNER")' "                                                 
        iterate m                                                                                                 
    end                                                                                                           
                                                                                                                   
                                                                                                                   
/*- add info owner:  (NEW DATA: member INPOWNER) */                                                               

    do  i=1 to idataow.0                                                                                           
        if  translate(left(idataow.i,12)) = "VFY" mbr then do                                                     
            oow = odataow.0+1                                                                                     
            odataow.oow = idataow.i                                                                               
            odataow.0 = oow                                                                                       
        end                                                                                                       
    end                                                                                                           
                                                                                                                   
    /*------------------------------------------------*/                                                           
/*  list members                                                                                                   
*/                                                                                                                 
/*- add info data for each member: (not data change) */                                                           
    odatainf.0 = 0                                                                                                 
                                                                                                                   
    Address TSO "alloc file(idd) dsname('"ipds"("mbr")' ) shr reuse"                                               
    if rc /= 0 then do                                                                                             
        say "alloc error("rc") for dataset'"ipds"("mbr")' "                                                       
        iterate m                                                                                                 
    end                                                                                                           
                                                                                                                   
    Address TSO "execio * diskr idd (stem idatainf. finis"                                                         
    if rc /= 0 then do                                                                                             
        say "EXECIO error("rc") for dataset'"ipds"("mbr")' "                                                       
        iterate m                                                                                                 
    end                                                                                                           
                                                                                                                   
/*- add info data for each memeber: (not data change */                                                           
    do  i=1 to idatainf.0                                                                                         
        if  translate(left(idatainf.i,3)) /= "VFY" then do                                                         
            o = odatainf.0+1                                                                                       
            odatainf.o = idatainf.i                                                                               
            odatainf.0 = o                                                                                         
        end                                                                                                       
    end                                                                                                           
    /*------------------------------------------------*/                                                           
                                                                                                                   
    Address TSO "alloc file(oddow) dsname('"opds"("mbr")' ) shr reuse"                                             
                                                                                                                   
    if rc /= 0 then do                                                                                             
        say "alloc error("rc") for '"opds"("mbr")'"                                                               
        iterate m                                                                                                 
    end                                                                                                           
                                                                                                                   
    /* write all record elaborate for each member */                                                               
    Address TSO "execio "odataow.0" diskw oddow (stem odataow."                                                   
    Address TSO "execio "odatainf.0" diskw oddow (stem odatainf. finis "                                           
                                                                                                                   
    if rc /= 0 then do                                                                                             
        say "EXECIO error("rc") for dataset'"opds"("mbr")' "                                                       
    end                                                                                                           
end                                                                                                               
    SAY 'end - exit'                                                                                               
exit                                                                                                               



MYLIB.SCRIPT.TEXT.INPUT(INPOWNER) input

Code:

VFY APP      RESPONSABILE                             AREA                CRITICA        CELL
VFY A31DG    name surname 1 new A31DG                 TEST A31DG          NO             A31DG1
VFY A31DG    name surname 2 new A31DG                 TEST A31DG          NO             A31DG2
VFY B7010    name surname 1 new B7010                 TEST B7010          NO             B70101
VFY B7010    name surname 2 new B7010                 TEST B7010          NO             B70102
VFY WIAX8    name surname 1 new WIAX8                 TEST WIAX8          NO             WIAX81
VFY WIAX8    name surname 2 new WIAX8                 TEST WIAX8          NO             WIAX82


MYLIB.SCRIPT.TEXT.INPUT

sample for WIAX8 input (old information)


Code:

VFY APP      RESPONS                    AREA            CRITICA   CELL
VFY WIAX8    name surname 1 old         AUTO.TEST       NO
VFY WIAX8    name surname 2 old         AUTO.TEST1      NO
VFY= CAMPO FISSO

========================================================================
Description : APP WIAX8
======================================================================
***********************************************************************
JOBNAME* *DESCRIPTION JOB         *                *CLASS* *RC**RESTART*
************************************************************************
WIAX8PPR   WIAX8PPR                        WIAX8PPR   0     00   JOB
WIAX8P01   WIAX8P01 DESCRIPTION script     WIAX8P01   0           NO
WIAX8P02   WIAX8P02 DESCRIPTION script     WIAX8P02   0           NO
WIAX8P03   WIAX8P03 DESCRIPTION script     WIAX8P03   0           NO
WIAX8P04   WIAX8P04 DESCRIPTION script     WIAX8P04   0           NO
WIAX8P05   WIAX8P05 DESCRIPTION script     WIAX8P05   0           NO
WIAX8TSX   WIAX8TSX                        WIAX8TSX   0     00   JOB
************************************************************************



MYLIB.SCRIPT.TEXT.OUTPUT(WIAX8)

output for new WIAX8 (update member)

news record from INPOWNER input (records 2,3) and the rest records from original member data (WIAX8) (start record 4)

Code:
VFY APP      RESPONSABILE                             AREA                CRITICA        CELL
VFY WIAX8    name surname 1 new WIAX8                 TEST WIAX8          NO             WIAX81
VFY WIAX8    name surname 2 new WIAX8                 TEST WIAX8          NO             WIAX82

========================================================================
Description : APP WIAX8
======================================================================
***********************************************************************
JOBNAME* *DESCRIPTION JOB         *                *CLASS* *RC**RESTART*
************************************************************************
WIAX8PPR   WIAX8PPR                        WIAX8PPR   0     00   JOB
WIAX8P01   WIAX8P01 DESCRIPTION script     WIAX8P01   0           NO
WIAX8P02   WIAX8P02 DESCRIPTION script     WIAX8P02   0           NO
WIAX8P03   WIAX8P03 DESCRIPTION script     WIAX8P03   0           NO
WIAX8P04   WIAX8P04 DESCRIPTION script     WIAX8P04   0           NO
WIAX8P05   WIAX8P05 DESCRIPTION script     WIAX8P05   0           NO
WIAX8TSX   WIAX8TSX                        WIAX8TSX   0     00   JOB
************************************************************************




That's what I thought for update my member with a new data information.

any suggestions for code rexx to improve it?...

now, the only problem that I find is a position columns, only in the record begins with VFY, how to order there? between a column and the other must be a one space.

Except column VFY (colum 1 to 3), and, APP (column 5 to 12) the column RESPONSABILE must begin always from column 14...

I will have to use POS functions right?? any suggestions please??


Thanks in advance
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top