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

IFTHEN/AREXP/BUILD ISSUE


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ojdiaz

New User


Joined: 19 Nov 2008
Posts: 98
Location: Spain

PostPosted: Fri Mar 13, 2009 5:28 pm
Reply with quote

Hello there guys

I'm starting to experiment with the many posibilities DFSORT has to offer, and i need to do something, but i have an error

I have a FB Input data set with a Record length of 300 bytes.

The file has multiple fields, but for this issue, I'll break it down to this:

From position 1 to position 112, alphanumeric characters
from position 113 on, there are four ZD fields with a length of 15, that is:

113:15,ZD
128:15,ZD
143:15,ZD
158:15,ZD

Then one indicator byte at position 173 is a character, a C letter or a blank space, and finally, the rest ar alphanumeric characters

I'm using a combination of IFTHEN/BUILD/OVERLAY/AREXP to multiply by minus 1 (-1) any of the ZD fields if the Indicator charater at position 173 is a C. Since i have to perform another operations afer that, I'm using icetool. Here is my code:

Code:

//PASOTEST EXEC PGM=ICETOOL                                 
//TOOLMSG  DD SYSOUT=*                                     
//DFSMSG   DD SYSOUT=*                                     
//SYSPRINT DD SYSOUT=*                                     
//*                                                         
//E1FICMIS DD DSN=FILE1.INPUT,DISP=SHR
//S1DCMISC DD DSN=FILE2.OUTPUT,         
//            DISP=(NEW,CATLG,DELETE),                     
//            DCB=(RECFM=FB,BLKSIZE=0),     LRECL=300,         
//            SPACE=(CYL,(500,100),RLSE),UNIT=SYSDA         
//TOOLIN   DD *                                             
  COPY FROM(E1FICMIS) TO(S1DCMISC) USING(CTL1)             
//CTL1CNTL DD *                                             
  SORT FIELDS=COPY                                                 
  OUTREC IFTHEN=(WHEN=(173,1,CH,EQ,C'C'),                           
                 BUILD=(1,111,                                     
                       (113,15,ZD,MUL,-1),TO=ZD,LENGTH=15,128))         
//                                                                 



The error code i have is this one:

Code:

IDENTIFIER FROM CALLING PROGRAM IS 0001                               
BLOCKSET     COPY  TECHNIQUE SELECTED                                 
VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
- CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 12:06 ON FRI MAR
  SORT FIELDS=COPY                                                   
  OUTREC IFTHEN=(WHEN=(173,1,CH,EQ,C'C'),                             
                 BUILD=(1,111,                                       
                       (113,15,ZD,MUL,-1),TO=ZD,LENGTH=15,128))       
END OF STATEMENTS FROM CTL1CNTL - PARAMETER LIST STATEMENTS FOLLOW   
DEBUG NOABEND,ESTAE                                                   
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL1,SORTIN=E1FIC
               IS,SORTOUT=S1DCMISC,DYNALLOC                           
SORT FIELDS=COPY                                                     
RECORD TYPE IS F - DATA STARTS IN POSITION 1                         
INCONSISTENT *OUTREC  IFTHEN 1 REFORMATTING FIELD FOUND               
C5-K26318 C6-K90007 C7-K90000 C8-K23476 E7-K24705                     
END OF DFSORT                                                         


After that, i changed the control card with this:

Code:
  SORT FIELDS=COPY                                                   
  OUTREC IFTHEN=(WHEN=(173,1,CH,EQ,C'C'),                             
                 BUILD=(1,111,                                       
                       (113,15,ZD,MUL,-1),TO=ZD,LENGTH=15))       


And executed correctly, however, the output file wasn't right. The fields in each record were all out of place. I think that since i need to check a character that is in one reformated output field (position 128 and ahead)the DFSORT util doesn't knows what to do.

Since that didn't work, then i tried to change the BUILD by an OVERLAY option, in order to change only the fields affected by the arithmetic operation, however, i have errors and i don't know what is wrong with this:

Code:
               OVERLAY=(113,15,ZD,MUL,-1,TO=ZD,LENGHT=15))


However, i can't seem to make Overlay function. This is the result i get ater a CC 16

Code:
IDENTIFIER FROM CALLING PROGRAM IS 0001                             
BLOCKSET     COPY  TECHNIQUE SELECTED                               
VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES
- CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 12:39 ON FRI M
  SORT FIELDS=COPY                                                 
  OUTREC IFTHEN=(WHEN=(173,1,CH,EQ,C'C'),                           
               OVERLAY=((113,15,ZD,MUL,-1),TO=ZD,LENGHT=15))       
                                                 $                 
SYNTAX ERROR                                                       
END OF STATEMENTS FROM CTL1CNTL - PARAMETER LIST STATEMENTS FOLLOW 
DEBUG NOABEND,ESTAE                                                 
OPTION MSGDDN=DFSMSG,LIST,MSGPRT=ALL,RESINV=0,SORTDD=CTL1,SORTIN=E1F
               IS,SORTOUT=S1DCMISC,DYNALLOC                         
SORT FIELDS=COPY                                                   
C5-K26318 C6-K90007 C7-K90000 C8-K23476 E7-K24705                   
END OF DFSORT


Any ideas about it?

Thanks in advance

Best regards

Oliver
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Mar 13, 2009 6:39 pm
Reply with quote

LENGHT is spelled LENGTH.....
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Mar 13, 2009 10:05 pm
Reply with quote

ojdiaz,

The first control cards did not have the length parameter specified for the field at 158 and that is the cause of the error

The second time you have the length misspelled.

Since your intention is to just modify a few fields use overlay instead of build. Here is the DFSORT JCL which will multiply the quantities at 113,128,143,158 by -1 if the value at pos 173 is 'c'

Code:

//STEP0100 EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD DSN=FILE1.INPUT,DISP=SHR
//SORTOUT DD DSN=FILE2.OUTPUT,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(500,100),RLSE)
//SYSIN    DD *
  SORT FIELDS=COPY
  OUTREC IFTHEN=(WHEN=(173,1,CH,EQ,C'C'),
  OVERLAY=(113:113,15,ZD,MUL,-1,ZD,LENGTH=15,
           128:128,15,ZD,MUL,-1,ZD,LENGTH=15,
           143:143,15,ZD,MUL,-1,ZD,LENGTH=15,
           158:158,15,ZD,MUL,-1,ZD,LENGTH=15))
/*
Back to top
View user's profile Send private message
ojdiaz

New User


Joined: 19 Nov 2008
Posts: 98
Location: Spain

PostPosted: Mon Mar 16, 2009 1:08 pm
Reply with quote

Skolosu, William Thompson

Thanks a lot for your Replay

I feel like a fool, i didn't saw that i have Length misspelled.

It worked perfectly. I wasn't aware of the implications of not coding the starting column for the overlay, C:FIELD

Now, it would be too different if I choose inrec instead of Outrec?

I'll keep working on this now, i'll summarize those fields on those accounting files, then I'll generete a few reports from them

Thanks a lot guys,

Oliver
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Mar 16, 2009 8:35 pm
Reply with quote

Quote:
Now, it would be too different if I choose inrec instead of Outrec?


Since you are dong a COPY operation, you can use INREC or OUTREC interchangeably.
Back to top
View user's profile Send private message
ojdiaz

New User


Joined: 19 Nov 2008
Posts: 98
Location: Spain

PostPosted: Tue Mar 17, 2009 4:45 pm
Reply with quote

Well, Actually i?ll sort the fields and then i'll do multiply operation, however, I usually test my sorts before with a SORT FIELDS=COPY

Therefore, in this case i think that i't won't matter, however, if I reformat one of the fields in the sort fields key, if I do it in the inrec or the outrec, i believe it changes the outcome, right?

I mean, If i change the fields in the inrec, the sorted records would be in a different order than if i changed them in an outrce, right?

I think i readed in the manual that Inrec is executed before any other operations specified in a sort card
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Mar 17, 2009 9:22 pm
Reply with quote

I said
Quote:
Since you are dong a COPY operation, you can use INREC or OUTREC interchangeably.


If you are doing a SORT operation, that's different. INREC is processed before SORT and OUTREC is processed after SORT. So for a SORT operation, the use of INREC or OUTREC can make a difference since SORT refers to the records reformatted by INREC.

Here's a Figure that shows the order of processing for DFSORT control statements:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA30/FIGSTMTSEQ?SHELF=&DT=20080528171007&CASE=&ScrollTOP=FIGSTMTSEQ#FIGSTMTSEQ
Back to top
View user's profile Send private message
ojdiaz

New User


Joined: 19 Nov 2008
Posts: 98
Location: Spain

PostPosted: Wed Mar 18, 2009 3:04 pm
Reply with quote

Thanks a Lot Frank. That, indeed, would make a huge difference if the reformated fields were part of the sorted fields.

Anyway, I'll keep looking at the docs, I usually find answers there, but sometimes the documents are confusing icon_confused.gif

The next thing i need to find out is if it is possible to validate if a DATE field is logical, i mean, 2009-01-01 is ok, but 2009-01-32 is not logical. I'll keep looking into it, i think it has something to do with the different date formats
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Mar 18, 2009 8:28 pm
Reply with quote

DFSORT does not have any built-in facilities for validating date fields.

You could, of course, use IFTHEN clauses with the appropriate logic to do your own validation.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Build a record in output file and rep... DFSORT/ICETOOL 11
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
No new posts Issue after ISPF copy to Linklist Lib... TSO/ISPF 1
No new posts Build dataset list with properties us... PL/I & Assembler 4
Search our Forums:

Back to Top