ALTSEQ statement

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
paheli
Member
Posts: 6
Joined: Tue Jul 01, 2008 10:10 pm

ALTSEQ statement

Post by paheli » Tue Jan 27, 2009 4:24 pm

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

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Jan 27, 2009 8:48 pm

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?
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

paheli
Member
Posts: 6
Joined: Tue Jul 01, 2008 10:10 pm

Post by paheli » Thu Jan 29, 2009 9:33 am

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.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Thu Jan 29, 2009 8:58 pm

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))
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

User avatar
arrbee
Active Member
Posts: 144
Joined: Fri Feb 24, 2006 11:33 am

Post by arrbee » Thu Jan 29, 2009 9:36 pm

Frank, how to apply this logic to replace null values instead of spaces?

Thanks.
Arr Bee
-------------
?My joy in learning is partly that it enables me to teach? - Seneca(Roman philosopher, mid-1st century AD)

User avatar
rangab
Active Member
Posts: 56
Joined: Fri Mar 17, 2006 3:21 pm

Post by rangab » Thu Jan 29, 2009 9:58 pm

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.
========
Ranga...:-0)
========
Learn Which You Don't Know - Teach Others Which They Don't Know.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Thu Jan 29, 2009 10:09 pm

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.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Thu Jan 29, 2009 10:14 pm

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.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

User avatar
rangab
Active Member
Posts: 56
Joined: Fri Mar 17, 2006 3:21 pm

Sorry :(

Post by rangab » Thu Jan 29, 2009 10:25 pm

Frank, sorry about it. :oops:
========
Ranga...:-0)
========
Learn Which You Don't Know - Teach Others Which They Don't Know.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others