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

Converting Hex to PD Special Condition


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Rick Ryan

New User


Joined: 29 Apr 2020
Posts: 14
Location: USA

PostPosted: Fri Oct 09, 2020 11:15 pm
Reply with quote

I am reading a table which is used to Create a file. I am converting Hex to PD, and everything works great except for 2 records, which have the zip code filled with spaces. Here is my desired output for this:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7-------+----7----+----8----+----9----+----0----+-
00499|MCCROCKLIN FORD          |683 NORTH EIGHTH    |   |MIDDLETOWN        |IN|    47356|
         
00500|AUTOPORT INC.            |203 PIGEON POINT R                         |           .|


Here is my Code:

Code:
000033  SORT FIELDS=COPY                                         
000034  INREC IFTHEN=(WHEN=(477,1,BI,EQ,X'40'),                 
000035        FINDREP=(INOUT=(X'40',X'F0')))                     
000036  OUTFIL FILES=OUT,                                       
000037         BUILD=(1:1,5, ,                     CUSTOMER     
000038                6:C'|',                                   
000039                7:7,25,                      CUSTOMER NAME
000040               32:C'|',                                   
000041               33:32,20,                     ADDRESS1     
000042               53:C'|',                                   
000043               54:52,20,                     ADDRESS2     
000044               74:C'|',                                   
000045               75:72,20,                     CITY & STATE 
000046               95:C'|',                                   
000047               96:92,5,PD,EDIT=(IIIIIIIIT),  ZIP           
000048              105:C'|',                                   
000049              106:X,                         FILLER       
000050              107:402,20,                    CNAME SHORT   
000051              127:5X,                        FILLER     
000052              132:C'|',                                 
000053              133:422,20,                    CADDRESS1 
000054              153:C'|',                                 
000055              154:442,20,                    CADDRESS2 
000056              174:C'|',                                 
000057              175:462,13,                    CCITY     
000058              188:5X,                        FILLER     
000059              193:C'|',                                 
000060              194:475,2,                     CSTATE     
000061              196:C'|',                                 
000062              197:477,5,PD,EDIT=(IIIIIIIIT), CZIP       
000063              206:C'|',                                 
000064              207:122,10,                    PHONE     
000065              217:C'|',                                 
000066              218:189,10,                    FAX       
000067              228:C'|',                                 
000068              229:163,1,                     CREDITA   
000069              230:C'|',                                 
000070              231:161,2,                     TYPE       


Here is my input data. The problem data is in columns 477 - 481.
Code:
 sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
 BROWSE    AH.AH0004.RTCUSEXT.G9451V00              Line 0000000821 Col 471 550
 Command ===>                                                  Scroll ===> PAGE
----+----8----+----9----+----0----+----1----+----2----+----3----+----4----+----5
----+----F----+----F----+----F----+----F----+----F----+----F----+----F----+----F
----+----8----+----9----+----0----+----1----+----2----+----3----+----4----+----5
 ------------------------------------------------------------------------------
N   IN..å.%                                                                     
D444CD00436444444444444444444444444444444444444444444444444444444444444444444444
5000950075C000000000000000000000000000000000000000000000000000000000000000000000
 ------------------------------------------------------------------------------
                                                                               
44444444444444444444444444444444444444444444444444444444444444444444444444444444
00000000000000000000000000000000000000000000000000000000000000000000000000000000
 ------------------------------------------------------------------------------


Here is my output:
Code:

 
 BROWSE    PAGAT98.CUSTEXT.SLIO.SEP.TXT.SSORT       Line 0000000822 Col 161 240
 Command ===>                                                  Scroll ===> PAGE
----+----7----+----8----+----9----+----0----+----1----+----2----+----3----+----4
             |                  |  |404040404|          |          |A|  |00| 0|
             |CHEEKTOWAGA       |NY|    14225|7168963938|7168973089|A|01|18|18|
             |JAMESTOWN         |NY|    14701|7164840121|7166640248|A|21|18|18|
             |GOUVERNEUR        |NY|    13642|3152870200|3152870960|A|01|69|69|
             |CENTRAL SQ        |NY|    13036|3156687102|3156683984|A|01|69|69|
             |MORROW            |GA|    30260|8884853029|6783643999|A|21|95|95|


Everything works great except where the Zip code in Cols 477-481 contains spaces (HEX 40). I cannot get an INREC or OUTREC statement to fix it. What am I doing wrong?
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1249
Location: Bamberg, Germany

PostPosted: Fri Oct 09, 2020 11:49 pm
Reply with quote

Please try:
Code:
INREC IFTHEN=(WHEN=(477,5,BI,EQ,X'4040404040'),                 
  OVERLAY=(477:X'000000000C'))

It should print '0' instead.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Sat Oct 10, 2020 12:19 am
Reply with quote

A better approach:
Code:
INREC IFTHEN=(WHEN=(477,5,PD,NE,NUM),                 
  OVERLAY=(477:X'000000000C'))

It should print '0' instead of any wrong data in that field.
Back to top
View user's profile Send private message
Rick Ryan

New User


Joined: 29 Apr 2020
Posts: 14
Location: USA

PostPosted: Tue Oct 13, 2020 11:13 pm
Reply with quote

Thank you so much! It works PERFECTLY!!!!!! icon_razz.gif
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Converting fixed length file to excel... IBM Tools 7
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts How to give complex condition in JCL . CLIST & REXX 30
No new posts Converting S9(18) value to a decimal ... DFSORT/ICETOOL 6
Search our Forums:

Back to Top