Page 1 of 1

ALTSEQ statement

Posted: Tue Jan 27, 2009 4:24 pm
by paheli
Hi,
I have a querry regarding ALTSEQ statement.
My input looks like this
----+----1----+----2----+
-00000-00000USD2..
-00000-00000USD...

When I used ALTSEQ statement, all the undisplayable characters i.e. ( all '.' ) were replaced by spaces and I got the o/p as

----+----1----+----2----+
-00000-00000USD2
-00000-00000USD

But my requirement is whenever there is undisplayble character, the entire field which contains that character should be replaced by spaces.

For ex.

if input is PA.HELI123456

then

output should be bbbbbbb123456----(expected output)

instead of PAbHELI123456----(output currently getting)


where '.' = undisplayable character
and 'b' = blank or space

Posted: Tue Jan 27, 2009 8:48 pm
by Frank Yaeger
What control statements did you use to get the current output?
But my requirement is whenever there is undisplayble character, the entire field which contains that character should be replaced by spaces.
What exactly is the programmable definition of the "entire field"? In your example, PA.HELI123456 are just characters ... what makes PA.HELI an "entire field"? Are the fields fixed length, or delimited in some way, or what?

What control statements did you use to get the current output?

Posted: Thu Jan 29, 2009 9:33 am
by paheli
Hi Frank
Thanks for your quick reply. Please find the explanation for the stated problem below, For example:- My input is like this,

Code: Select all

EMPLOYEE- EMPLOYEE-CODE
NAME
5/AN          5/AN         
(1-5)         (6-10)       
1------------ 2------------
***************************
GIRI3         11111        
GIRI2         22??2        
GIRI1         33333        
GIRI5         44444        
GIRI4         5???5        
***************************
Now I wrote a jcl to replace undisplayable char say ? if any from EMPLOYEE-CODE field with spaces

Code: Select all

//SYSIN    DD *                  
  SORT FIELDS=COPY               
  ALTSEQ CODE=(6F40)             
  OUTREC FIELDS=(1,5,        
      6,5,TRAN=ALTSEQ)
/*  
Thus I got the output as,

Code: Select all

EMPLOYEE- EMPLOYEE-CODE
NAME
5/AN          5/AN         
(1-5)         (6-10)       
1------------ 2------------
***************************
GIRI0         11111        
GIRI1         22    2            
GIRI2         33333        
GIRI3         44444        
GIRI4         5     5        
***************************   
but I want the output in following way,

Code: Select all

EMPLOYEE- EMPLOYEE-CODE
NAME
5/AN          5/AN         
(1-5)         (6-10)       
1------------ 2------------
***************************
GIRI0         11111        
GIRI1                 
GIRI2         33333        
GIRI3         44444        
GIRI4                          
***************************                             
that means if the undisplayable char is present at any of the position then i want ALTSEQ to replace not only that char at that position but also all the positions. Hope this much info is helpfull to you to guide me in a proper way.

Thanks in advance.

Posted: Thu Jan 29, 2009 8:58 pm
by Frank Yaeger
Here's a DFSORT job that will do what you asked for:

Code: Select all

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
GIRI311111
GIRI222??2
GIRI133333
GIRI544444
GIRI45???5
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  SORT FIELDS=COPY
  OUTREC IFTHEN=(WHEN=(6,5,SS,EQ,C'?'),
    OVERLAY=(6:6X))
/*

Posted: Thu Jan 29, 2009 9:36 pm
by arrbee
Frank, how to apply this logic to replace null values instead of spaces?

Thanks.

Posted: Thu Jan 29, 2009 9:58 pm
by rangab
Paheli,

You can try this File-Aid solution also.....

Code: Select all

//STEP01   EXEC PGM=FILEAID        
//SYSUDUMP DD  SYSOUT=*            
//SYSPRINT DD  SYSOUT=*            
//SYSLIST  DD  SYSOUT=*            
//SYSTOTAL DD  SYSOUT=*            
//DD01     DD  *                   
GIRI311111 
GIRI222??2 
GIRI133333 
GIRI544444 
GIRI45???5
//DD01O    DD  SYSOUT=*            
//SYSIN    DD  *                   
$$DD01 COPY REPL=(1,EQ,X'00',X'FF')
//*                                
HTH.

Posted: Thu Jan 29, 2009 10:09 pm
by Frank Yaeger
how to apply this logic to replace null values instead of spaces?


If you want to put 6 binary zeros in the field, you can use 6X'00' or 6Z instead of 6X.

Posted: Thu Jan 29, 2009 10:14 pm
by Frank Yaeger
Ranga,

That FileAid job DOES NOT do what the OP asked for. It only replaces a X'00' in the first byte with X'FF'. If you'd bothered to test it with the OP's data, you would have figured that out.

Please don't post FileAid solutions in the DFSORT Forum (there's a separate Forum for people who want FileAid solutions), especially FileAid solutions that aren't even solutions for the problem given.

Sorry :(

Posted: Thu Jan 29, 2009 10:25 pm
by rangab
Frank, sorry about it. :oops: