The Scramble Bytes (SCRAMBLE) Command

IBM i (OS/400, i5/OS)
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

The Scramble Bytes (SCRAMBLE) command can be useful when you want to store sensitive data. The SCRAMBLE command does just what its name implies-it scrambles or unscrambles any character string, up to a length of 256. It doesn't actually encrypt the characters (e.g., character A will still be stored as an A); it only changes the order of the characters in the string. The scrambling is done by randomly shifting the order of the bytes within the source character string. If your sensitive data is comprised of short strings, you may want to consider some other encryption method.

The command processing program for this command is an RPG program. The program returns without setting on the LR indicator, so it is still active upon returning. The FREE command or the Reclaim Resources (RCLRSC) command can be used to deactivate the program. This command can be used only in a CL program.

Required Parameters

INPUT Specify the name of the CL program variable that contains the field to be scrambled, or specify the value to be scrambled. This must be defined as a *CHAR field and can be up to 256 bytes long.

OUTPUT Specify the name of the CL program variable that is to contain the scrambled field. This must be defined as a *CHAR field and must be the same length as the field or value in the INPUT parameter.

PROCESS Specify whether the value named in INPUT is to be scrambled or unscrambled.

*SCR: The value in INPUT is to be scrambled. The scrambled string is returned in the variable specified in OUTPUT.

*UNS: The value in INPUT is to be unscrambled. The unscrambled string is returned in the variable specified in OUTPUT. When this *UNS value is specified, the value in SCRCDE must be the same as when the value was scrambled.

LEN Specify the number of characters in INPUT that are to be scrambled. This must be less than or equal to the length of the field. Valid values range from 2 to 256.

SCRCDE Specify the scramble code that is used to control the scrambling and unscrambling process. The value may be given as a constant or a CL program variable. Any value may be specified for this string, encompassing character values from hex '00' to hex 'FF'. The same SCRCDE used to scramble the data must be used to unscramble it. SCRCDE must be defined as a *CHAR field, length 10.

Example

 SCRAMBLE INPUT(&TEXTIN) + OUTPUT(&TEXTOUT) LEN(80) + SCRCDE('SCRAMBLE ') 

This command scrambles bytes within field &TEXTIN and places the scrambled result into field &TEXTOUT. The INPUT and OUTPUT fields are 80 bytes long. The scramble code used is the word SCRAMBLE, followed by two blanks.

Source Members

 INFO: SCRAMBLE (QATTINFO) CDO: TAACLPF (QATTCMD) CPP: TAACLPFR (QATTRPG) 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: