MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DFSORT: Can we convert Packed field on conditional basis

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Himanshu
Beginner


Joined: 23 May 2016
Posts: 4
Topics: 2
Location: India

PostPosted: Mon Jul 04, 2016 1:40 pm    Post subject: DFSORT: Can we convert Packed field on conditional basis Reply with quote

Hi,

I have an input file which has chars in column 1 to 5.
From column 139 to 141 (length 3) the data is in packed format, but for some records its spaces.
Similarly from column 142 to 144 (length 3) the data is in packed format, but again for some records the value is spaces.

I have to split the data in two files where in first file I want values from column 1-5 & from column 139 to 141 (in displayable format), but wherever its spaces in col 139 to 141, it should comes as spaces in output.

Similarly in second file I want values from column 1-5 & from column 142 to 144 (in displayable format), but wherever its spaces in col 142 to 144, it should comes as spaces in output.

My Sysin Card is below:

Code:
SORT FIELDS=(1,5,CH,A)
SUM FIELDS=NONE       
OUTFIL FILES=01,BUILD=(1,5,2X,139,3,PD,EDIT=(IIIIT),C',',1X)
OUTFIL FILES=02,BUILD=(1,5,2X,142,3,PD,EDIT=(IIIIT),C',',1X)


But wherever there ares] spaces in column 139 to 141 & col 142 to 144, it is coming as character 40404.

Is there any way to convert that Packed field on conditional basis?

Thanks
_________________
Himanshu
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Mon Jul 04, 2016 10:30 pm    Post subject: Reply with quote

Himanshu,

It is quite simple. You can use IFTHEN cond to write out the values. Btw do you really need sort the file and eliminate duplicates.

Either way use the following control cards(untested)

Code:


//SYSIN.   DD *
  INREC BUILD=(1,5,139,6)
  SORT FIELDS=(1,5,CH,A)
  SUM FIELDS=NONE

  OUTFIL FILES=01,
  IFTHEN=(WHEN=(6,3CH,EQ,C' '),
   BUILD=(1,5,7X,C', ')),
  IFTHEN=(WHEN=NONE,
   BUILD=(1,5,2X,6,3,PD,EDIT=(IIIIT),C', '))

  OUTFIL FILES=02,
   IFTHEN=(WHEN=(9,3,CH,EQ,C' '),
    BUILD=(1,5,7X,C', ')),
   IFTHEN=(WHEN=NONE,
   BUILD=(1,5,2X,9,3,EDIT=(IIIIT),C', '))


_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Himanshu
Beginner


Joined: 23 May 2016
Posts: 4
Topics: 2
Location: India

PostPosted: Tue Jul 05, 2016 5:45 am    Post subject: Reply with quote

Hi Kolusu,

It is working.

Thanks
_________________
Himanshu
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group