Updating record to a data set



IBM's Command List programming language & Restructured Extended Executor

Updating record to a data set

Postby xboss » Fri Dec 24, 2010 11:23 am

I am trying to update a record to a PDSE member, here is code on rexx.... I can see the result in SDSF(SYSPRINT) but I could not update same record to a PDSE data set member... My program runs with rc=0 but PDSE member does not get updated. Any suggestion?
/* REXX */                                                 
"EXECIO * DISKR INFILE (STEM RECORDS. FINIS"                 
SUM = 0                                                       
DO I = 1 TO RECORDS.0                                         
  IF SUBSTR(WORD(RECORDS.I,1),1,5) = 'xxxxx' THEN ITERATE     
  IF SUBSTR(WORD(RECORDS.I,1),1,5) = 'xxxx' THEN ITERATE     
  IF SUBSTR(WORD(RECORDS.I,1),1,6) = 'xxxx' THEN ITERATE   
    NUMBER.I =  SUBSTR(WORD(RECORDS.I,1),6,12)               
END                                                           
  DO J=1 TO RECORDS.0                                         
     IF SUBSTR(WORD(NUMBER.J,1),1,6) = 'xxxx' THEN ITERATE 
        R=CHECKSUM(NUMBER.J)                                 
        IF R==0 THEN VALID.J = NUMBER.J                       
                ELSE INVALID.J = NUMBER.J                     
END                                                                   
/*       IF R==0 THEN SAY NUMBER.J "  VALID CARD!"                   
                  ELSE SAY NUMBER.J " INVALID CARD!" */           
 "EXECIO * DISKW OUTFILE1 (STEM VALID. FINIS"                         
 "EXECIO * DISKW OUTFILE2 (STEM INVALID. FINIS"                       
/* END */                                                     
EXIT         
                                                                 
CHECKSUM: PROCEDURE; PARSE ARG T                                     
IF LENGTH(T)//2 THEN T='0'T     
  T=REVERSE(T)                                                       
  S=0                                                                 
                                                                     
DO J=1 TO LENGTH(T)-1 BY 2                                           
   Q=2*SUBSTR(T,J+1,1)                                               
IF Q>9 THEN Q=LEFT(Q,1)+RIGHT(Q,1)                                   
   S=S+SUBSTR(T,J,1)+Q                           
END                                               
                                                 
RETURN S//10\==0                                 
xboss
 
Posts: 79
Joined: Mon Nov 29, 2010 10:55 am
Has thanked: 0 time
Been thanked: 0 time

Re: Updating record to a data set

Postby NicC » Fri Dec 24, 2010 2:27 pm

I think you have to CLOSE/FREE/ALLOCATe and OPEN again but I am not 100% sure on that.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Updating record to a data set

Postby MrSpock » Fri Dec 24, 2010 7:08 pm

You need two seperate indexes, one to be incremented for each value of the stem variable VALID., and one for each value of the stem variable INVALID.

Something like:

VAL_IDX = 0
INVAL_IDX = 0
DO J=1 TO RECORDS.0                                         
     IF SUBSTR(WORD(NUMBER.J,1),1,6) = 'xxxx' THEN ITERATE 
     R=CHECKSUM(NUMBER.J)                                 
     IF R==0 THEN
       DO
         VAL_IDX = VAL_IDX + 1
         VALID.VAL_IDX = NUMBER.J
       END                     
     ELSE
       DO
         INVAL_IDX = INVAL_IDX + 1
         INVALID.INVAL_IDX = NUMBER.J
       END                     
END           
User avatar
MrSpock
Global moderator
 
Posts: 809
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: Updating record to a data set

Postby xboss » Fri Dec 24, 2010 9:32 pm

Thanks MrSpock. I saw where my brain got clogged.
Thanks NicC for your input.
Problem is solved.

You guys have Happy Holiday. 8-)
xboss
 
Posts: 79
Joined: Mon Nov 29, 2010 10:55 am
Has thanked: 0 time
Been thanked: 0 time


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post